Extjs4 combobox set value field and display fileld

你。 提交于 2019-12-11 11:32:37

问题


I'm using Extjs4. I've to set combobox display field and value field in form load. setValue() not working for comboxes in form load. I'm using bellow code Please let me know whats wrong with my code.

quiz_edit_form.load({
    url: BASE_URL + 'courses/testing/getCourseTest/' + quiz_id,
    method: 'POST',
     success: function(form, action){
            var chap_name = action.result.data.test_chapter_combo;
            var less_name = action.result.data.test_lesson_combo;
            Ext.getCmp('test_chapter_combo1').setValue(chap_name);
            Ext.getCmp('test_lesson_combo1').setValue(less_name);
            }
});

Thanks


回答1:


I've recently had a similar issue with the combos. Ensure the forceselection attribute on the combo's are set to false, or it won't allow you to set any values that aren't in the store - and the store won't be loaded until a user clicks the trigger. If you do need to have the users only select options from the combo, set forceselection: false, then setValue and setRawValue, then forceselection: true.

Hope that helps.




回答2:


The value you are trying to set must be present in the store bound to your combo. To get your values in the store you must have it autoloaded or load it way ahead of time - remember the store loads asynchronously.



来源:https://stackoverflow.com/questions/9327629/extjs4-combobox-set-value-field-and-display-fileld

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