Set value for ExtJS.form.ComboBox - extjs

I have an Ext.grid.EditorGriPanel which has an combobox editor in its columnModel (the store of combox has just only 2 items: enabled/disabled). When a new blank row is inserted to grid, I want the combobox in that column have to be set to a default value (enabled), and the dropdown is not expanded.
I've tried to use
grid.colModel.columns[2].editor.select(0)
to get the combobox editor and set "enabled" value for it, but it did not work. Another way is using grid.colModel.columns[2].getCellEditor(rowIndex), but it returns an EditorGrid (I was so surprised because the ExtJS 3.3.1 API doesn't have this component).
Could you please help me on this problem?
Thank you so much!

When a new blank row is inserted to
grid, I want the combobox in that
column have to be set to a default
value (enabled), and the dropdown is
not expanded.
When the new record is inserted to the grid's store, the value of your column (in the record) needs to be set to "enabled". I'm not sure if you are doing it like this currently? In other words, the value must not be set to the editor of the column. Set it directly in the record.
(Also, you can define default values to be used for all records using the recordType property of the store - see ExtJS API documentation for more details - but this is optional.)
Finally, note that the combobox will not be displayed immediately after the row is added. The combobox is displayed only when you start editing that particular cell - this is the way EditorGrid works in ExtJS. But at least you should get the new row to immediately display the correct value ("enabled") with this advice.

Related

How can I update the contents of a ComboBox embedded in a GridX

I am in the process of altering an existing GridX table to add a new column which contains a drop down, the contents of which will be different for each row.
I have added the dropdown as a combobox by setting the cell's structure as
widgetsInCell: true,
Which will make the combobox's cell a decorator.
My issue now is that the update function operates by getting the gridx's and setting a new store.That works for text data but I can't find a way of creating a store which will populate the combobox.
Do I need to integrate somehow with the cell's setCellValue hook?
Thanks
You can use dijit/form/FilteringSelect
dojo FilteringSelect
If all your rows data from same store, use query to filtering data.(e.g. query: {state: /.*/})
Otherwise use "dojo/store/JsonRest" get data from server.

Codename One ComboBox how to highlighting already selected value

We are able to create ComboBox and populating data too. But we need to highlighting already saved values. Can you please suggest code for this.
Our requirement is if Combobox has 1,2,3. If I select 2 and save. We need to set the combo box value 2 in such way that when we open the Combobox need to display this 2 as highlight value along with 1,2,3 values.
Simply same as select box option selection.
I would generally recommend avoiding ComboBox altogether.
Assuming this isn't an option you will need to define a renderer and disable the OS specific 2 render mode using a theme constant:
otherPopupRendererBool=false

ADF Table Editable Field Issue

I am updating an application written in ADF 11.1.1.3. In almost all of my screens, i have ADF Tables with editable fields and every table has a row selector enabled.
I have a problem where if a user clicks in an editable field, of a table row that isnt yet selected, the field row selector appears to fire off and then the browser loses the focus on the field that the user intended to select.
Per my example screen above, the 2nd table row is currently selected. However, if i click inside any editable field in row 3 (like End Date), browser sets the focus on the field. But then the Table Row Selection listener invokes immediately after, and then takes the focus off the field i originally clicked. This happens on any editable field type.
The most annoying thing is when i update a checkbox of a table row (not selected), the value is immediately overwritten back with its original value.
Currently, the only way to get around this problem, is the user first selects the table row, then updates the field data.
Any experience with this issue? I'm thinking about a client listener or value change listener but wanted to see what your thoughts are.
Thanks!
Update 01:
I set "immediate" property to "true" for the table, still get the same results. I applied immediate=true to the parent Panel Boxes, same results.
Update 02:
The table's Iterator' and Binding's ChangeEventPolicy was set to default (none). But i set it to none anyways. Same results..
Update 03:
Removed validators, same result.
Does your selection listener still retains "#{bindings.xxx.collectionModel.makeCurrent}"? this is used to set the currently selected row as current row, if you have removed this then it means that even when you select the row by clicking on a field, the model still has previous row selected in its iterator.

Devexpress checkbox column in a gridcontrol c#

I have a datagrid from devexpress in a winform application.I populated the datagrid from code (datasource=my datatable with 2 strings columns and one of type int (receive 0 and 1 values-should be checkbox on form).
I added a datagrid and from designer I added 3 columns.The last one of type checkbox.I set
UnboundType=Integer,
UnboundExpression=my column name from datatable :
DisplayFormat = Numeric,
columnedit = checkbox,
Displaycheckedvalue = 1,
displayuncheckedvalue = 0.
When I run the application always my checkboxes are blue.If i press one checkbox appear a check but when i go to the next row the previous value is again blue.What should i do so why the application keep the checks?
Don't set the column to be unbound, it is in your datasource after all.
What you want to do is just to set Displaycheckedvalue and displayuncheckedvalue as you have done, nothing more.
You can make a class which got a property for each column of your table. The int value would be a bool and so you can use List as datasource. The Grid will automaticly add checkboxes for the bool value.
If you want to use DataTable see Stig's post but in my opinion it is more beautiful to use classes and List.

ExtJS 4 - How to avoid grid column value becoming null when column editor is combo-box?

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.

Resources