ramses Posted May 6 Posted May 6 i have 2 issues: FIRST: i do assign a combobox (for user searching) after retrieving from the DB like this: var LList: TStringList; ... cbUser.Items.Assign(LList); >> now i want to expand the combobox when Items.Count > 0 the combobox is filled correctly when i open it manuially, no chance to open it per code. tried a lot experimenting with JS but it doesn't react e.g. on cbUser.JSInterface.JSCode( 'if (this.rendered && this.getStore().getCount() > 0) {' + ' this.expand();' + '}' ); How should i configure the combobox and how to perform the auto expand? SECOND: when i select an item (combobox opened manually) the the OnSelect is fireing but the ItemIndex is always -1, doesn't matter which item is choosed WHY? and how to get the right itemindex? Quote
Sherzod Posted May 6 Posted May 6 Hello, Which uniGUI version are you using? Also, could you please create a simple test case to reproduce both issues? Quote
ramses Posted May 7 Author Posted May 7 Hi, i'm using uniGUI 1.95.0.1610 & Ext JS 7.9.0 i tried to make the demo very near to the real app, regarding this functionality. Please check the comments in source. Interesting and not explainable why in the demo the reading of the ItemIndex is working but in my app not...maybe you can figure it out as the only difference in the demo is that StringList is filled manually and in my app it comes from the DB thank you! Test_ComboBox.rar Quote
Sherzod Posted May 13 Posted May 13 Hello @ramses cbUser.JSInterface.JSCode( 'console.log(this); if (this.rendered && this.getStore().getCount() > 0) this.expand();' ); Try this approach: cbUser.JSInterface.JSCode( 'Ext.defer(function(){' + ' var cb = '#1', st = cb.getStore();' + ' cb.lastQuery = null;' + ' st.clearFilter();' + ' cb.getPicker().bindStore(st);' + ' cb.getPicker().refresh();' + ' cb.expand();' + '}, 10);' ); Quote
ramses Posted May 13 Author Posted May 13 excellent, thank you! the auto expand works but in the OnSelect event the ItemIndex is always -1 regardless of what i am selecting in the combobox. and more interesting is that in my short demo is working but not in the main app. am i missing something? Quote
Sherzod Posted May 13 Posted May 13 26 minutes ago, ramses said: and more interesting is that in my short demo is working but not in the main app. Could you please check the browser console for any JavaScript errors? Since the same code works in the small demo but not in the main application, there may be some client-side error or another script interfering with the ComboBox selection/state. Quote
ramses Posted May 15 Author Posted May 15 thank you, solved using the cbUser.Text instead of the itemindex prop. would be nice to have a full documentation of the components, as in this case is a detective job to find out which prop and event is exactly doing. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.