Extjs combobox not reflect after store item removal - extjs

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'.

Related

Reset a ComboBox

I have a view that contains several ComboBox elements. For some reason old data remains from the previous time the view was opened and I would like to reset the combobox elements in the view every time it is opened. Is there a function that could that for me? I want it to be exactly how it is as if I rendered it the first time with the initial items. Would using setSelectedItem(vItem), setSelectedItemId(vItem), setSelectedKey(sKey), setShowSecondaryValues() help? If so, what do these keywords mean (selectedItem, selectedItemID, selectedKey, secondaryValues)?
Unfortunately you do not provide an example. Normally you bind your UI controls against a model, e.g. JSONModel. In this case the items of your ComboBox controls would be taken from the corresponding model. However, you can use method removeAllItems to achieve the desired behaviour.
UPDATE: Obviously the controls are bound and only the selection should be cleared.
Use setSelectedItem with value null to clear the selection. You could also use the binding to set the selected item automatically by using the selectedKey attribute, see example.

ExtJS lazy combo initial value

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.

ExtJS 3.4 :: Combobox in grid - wrongly selecting first value when opened

Using ExtJS 3.4
I have a EditorGridPanel and columns with ComboBoxs.
Just noticed that if I three options, say...
Dog
Cat
Mouse
...and Mouse is the saved value, then when I click the dropdown, my field gets populated with Dog - without me selecting it. Whatever the options, my field gets populated with the first value.
This only happens after an initial page load and the first time I click a combobox. Subsequent combo clicks do not elicit this behavior.
Anyone experienced anything like this? Any clue?
Thanks
Paul
autoSelect : false
for combobox component will solve this. Read ExtJS Documentation for more details.

silverlight combobox - highlight a few items in the popup list

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?

How i can turn off autocompletion in Extjs combobox?

When I selected some item in combobox and then I'm trying to select another item in same combobox, I can see only one item - those which is selected right now. I believe that happens because of autocompletion. Does anybody know how I can disable it or something. I need to see all values on each click, regardless if something was selected already or not.
Add triggerAction:'all' to your config.
better add disableKeyFilter:'true' to your combo box

Resources