PDA

View Full Version : How to load data in a combo box column in an editable Grid



sajan
8 Jul 2010, 7:57 AM
I am stuck loading JSON data on the combo box in an editable grid.
Any help is appreciated.

jarrednicholls
8 Jul 2010, 12:20 PM
Hi sajan,

Does the ComboBox have a JsonStore attached to it? Have you set your displayField and valueField properties yet, which match the names of your fields in your JsonStore? Perhaps a little more information, and I can help for sure. Maybe you can attach your project and I can check what's there and what needs to be added.

Thanks,
Jarred

sajan
8 Jul 2010, 5:40 PM
Thanks Jarred,
I have it like this .this is part from "quote line" grid which is on ql.ui.js file

{
xtype: 'gridcolumn',
header: 'Currency',
sortable: true,
width: 100,
dataIndex: 'T7F5',
id: 'Currency',
editor: {
xtype: 'combo',
store: 'CurrencyStore',
displayField:'T3F4',
valueField:'T3F4',
lazyRenderer:true,
id: 'CurrencyCombo',
autoRef: 'CurrencyRef'
}
on firebug JSON is coming fine but I think it is not showing because of scope.
So I tried

this.CurrencyRef.store.load on ql.js file
but it is showing this.CurrencyRef is undefined
but when I set the store on "autoload" it doesn't show any error but doesn't show any value on the combo grid
I have slowest connection on home . SO I will try to send you the project (if you think I am wrong) during the day
thanks

jarrednicholls
8 Jul 2010, 6:28 PM
If the same JsonStore (CurrencyStore) is attached to a GridPanel with the columns properly setup, does the data show up in the grid when you load the data in the store? Just thinking of a quick way to test if the data is loading up (visually). When you load the data in the store (Right-click->Load Data) does it say "# record loaded"?

One last thing, try setting the triggerAction to "all", which will load all of the items when the trigger button is clicked...that might be what's missing.

sajan
8 Jul 2010, 8:19 PM
Hi Jarred,
Yes It worked when I set triggerAction to "all",
but will it load every time the row in a grid is clicked?
If yes then it will be bad cause the data once loaded is always static for all the rows
thanks

jarrednicholls
8 Jul 2010, 8:40 PM
You can set the "mode" to "local", which will not cause a reload of the data. If your store is set to "autoLoad", then it will load one time and never again. The ComboBox will simply pull the loaded records from the store every time the trigger button is clicked when its mode is set to "local".

sajan
8 Jul 2010, 8:48 PM
Thanks Jarred,
u r a hero.
yes now I am 90 % done in my project. But my problem still exists while saving the data from the grid.
I added 2 events
1. "on afteredit" just to commit the change
2. on row deselect- this saves the data. but some times it doesn't pick the change in last edited cell. so how to handle all the update in the row?

as far as I reckon you previously mentioned to save all the data when "save button is clicked"
so how to send entire data back to the server?
thanks