I have lazy loaded combo in ExtJs form. Form data are loaded to form from grid store by form.loadRecord(). The lazy combo items are pairs 'value' => 'DisplayedName' and of course each of records in grid store has already its own 'valuexyz' to be set to combo after the record is loaded to form. The problem is that when the record is loaded to form, there are no items in combo yet (combo is lazy, and its items are loaded only when it is clicked) a so combo cannot to display proper 'DisplayNameXyz' corresponding to 'valuexyz' of loaded record. Even if combo get loaded, it is paged (by 25 items per page) and so it is quite possible that the record 'valuexyz' for combo will not be included in the first page of loaded combo items. Combo stays empty.
Is there a solution for this?
Thanks in advance!
I have found this answer but it is quite brief and I'm not sure even if it is correct and how to implement it.
If you need data to exist in the combobox store that may not be loaded yet due to paging, then you have to get rid of the paging.
Related
I have a combo box(with remote store) which needs to be loaded based on two other combo box selected values. So i kept the remote store autoLoad to false. and as soon as second combo value is selected i am loading this combo store.
Till this point it worked well for me.
But my client request is: When the combo box drop down is clicked, it has to reload the remote store based on other two combo values. So i have tried expand event to load the store whenever the combo box is expanded. After the store is loaded successfully, the expanded combo is loosing the selection and it is not allowing to select any value. I mean when user clicks the drop down it is loosing the focus and dropdown is collapsing automatically. I am sure that the request is sent to server to load the store but combo box expand is not working properly.
Can someone help me to solve this problem?
I really stuck up here.
Thanks,
Valli
Finally i found the answer as below:
1) Listen to expand event and send an ajax request to load the store.
2) Once store is loaded successfully set the data to store using store.loadRawData method.
I am new in Extjs and stuck at one point where I want to remove 2 items from the combo store which should reflect in the combobox. Strange thing is that when i put alert message above the following code it refreshes the combobox with those items removed, but not when this alert removes.
//alert('test');
var decTypCombo=Ext.ComponentQuery.query('#ddlDecisionType')[0];
decTypCombo.store.remove(decTypCombo.store.getById(16));
decTypCombo.store.remove(decTypCombo.store.getById(17));
decTypCombo.lastQuery=null;
Please let me know if I am doing wrong somewhere thanks.
Ensure that queryMode is set to 'local'.
I have a column in a grid with editor as combo-box.
When the grid is loaded then all the column values get displayed properly.
The issue is, when user clicks at the column (having combobox as editor) to edit it then the column value becomes null as shown in the attached screenshot.
I understand that the value becomes null as the store of combobox has not been loaded yet.
I can not use autoLoad true due to the heavy amount of data present in the combobox store. Moreover, even if I use autoLoad:true for the store with paging in it, then that too safeguards only those values which are present in the first page and not all.
Thus, how can I maintain the value in grid column when that value is not present in the store of combobox used as editor for the column?
Could anyone guide at this?
PS: I am using ExtJS Ver 4.0.2a
I have been able to find a solution for this.
It has more to do with the version of ExtJs. If we upgrade to 4.0.7 and then use forceSelection:false for a combobox then things work fine as expected. That is, the combo-box accepts a value which doesn't exist in its store and doesn't set the current value to null.
Hope this helps someone else too looking for something similar.
I would suggest having the grid record contain both that columns value, as well as display value. If the combo store lookup is unable to find a matching value (because that combo store hasn't been loaded yet), then revert to showing the display value stored with the grid record.
You might also need to have the afteredit event on the grid update that grid records display value after that column is edited for a particular row.
In an Ext Js-application I am working on I have a formpanel that contains (among other controls) three comboboxes, each with a different datastore. I need to load the form with existing data and display that in the form. This works for all simpel controls (textboxes, checkboxes) but there is a problem with the comboboxes.
The comboboxes each use a datastore but I can see that there is only one store loaded before the form loads its own data, causing that one combobox to display the correct text and the other two the value. If I click and close the combobox without making a selection the correct text appears.
Is there a way to either delay the loading of the form or the binding of the form until all datastores have loaded? The datastores are local stores with autoload and the formpanel calls its own load in the afterlayout-event.
The problem is that the setValue executed by loading your form is executed before the stores of the combo boxes are actually loaded.
You could try to implement the fix condor and animal of ExtJS have propsed in this forum thread on sencha.com: http://www.sencha.com/forum/showthread.php?75751-OPEN-42-ComboBox-s-setValue-call-with-a-remotely-loaded-Store
It basically just delays the setValue call on any combobox until the store of the combobox is fully loaded.
Load the form panel after the rendering is complete. Is there any specific reason you are loading the form in afterlayout event?
Load the form in afterrender event rather than afterlayout. the afterrender event happens when all form is completely rendered.
I'm wondering if I can make fake sections in the popup menu:
The rule would be, if the 5th character of the displayed item is different from the 5th char of the previous item in the menu, it has to be highlighted
What do you think?
Thanks!
To achieve this would be a hack.
Normally the items that appear in the popup part of a combo box will be an instantiated data template, and each gets its own data item and has no clue or knowledge of the other items in the list, so you couldn't use a converter or anything else to achieve this behavior.
What you could do though is inject (attach) your own control into the popup part of the combo box, and take over the rendering of the data items. How you do this will depend upon which combo box you are using (i.e. MS or some other vendor's) and would be a whole new question.
Would that be easier if I were to create my own combobox as follow:
a TextBox associated with a Button that when pushed would popup a datagrid in which I could implement this conditional formatting?