ExtJS - 'combocolumn' based renderer - rowediting does not register event or do what it is supposed to

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 14:25:18

问题


http://2gears.com/2011/05/combobox-editor-remote-and-renderer-for-extjs-editorgridpanel/comment-page-2/#comment-11050?

Please see the function.

I am not using the 'combocolumn' completely. However i have used the major components. Please advise if there is a possibility it should work. As of now the grid refuses to render the column itself and I am unable to pinpoint what the bug is as the code is simply the same? I did this not to act smart :) - but to simplify and run it on 1 column before standardizing the component common to the project.

The COMBO RENDERING fn()

<code>
function ComboBoxRenderer(combo, gridId) {

    var getValue = function (value) {
        var idx = combo.store.find(combo.valueField, value);
        var rec = combo.store.getAt(idx);
        if (rec) {
            return rec.get(combo.displayField);
        }
        return value;
    };

    return function (value) {
        if (combo.store.getCount() === 0 && gridId) {
            console.log(combo.store.getCount()+gridId);
            combo.store.on(
                    'load',
                    function () {
                        var grid = Ext.getCmp(gridId);
                        if (grid) {
                            grid.getView().refresh();
                        }
                    },
                    {
                        single: true
                    }
            );
            return value;
        }

        return getValue(value);
    };
//    Ext.getCmp(gridId).getView().refresh();
}
</code>

Editor - in Grid Column Model

{ header: 'Plan Type', dataIndex: 'plan_id', editor: { // allowBlank: 'false', xtype: 'combobox', queryMode: 'local', store: planTypeStore, displayField: 'plan_name', valueField: 'plan_id' } ,renderer: ComboBoxRenderer(this.editor, 'gridPanelId') /*this is the docs based renderrer - which wont work */ //, renderer: function (val) { // var rec = planTypeStore.findRecord('plan_id', val); // return (rec !== null ? rec.get("plan_name") : ''); // }

来源:https://stackoverflow.com/questions/29791410/extjs-combocolumn-based-renderer-rowediting-does-not-register-event-or-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!