tags:

views:

75

answers:

2

Ok, so we've got the latest JQGrid grid working beautifully, but the editoption value param doesn't seem to do the required replaces in the grid values. This did work in a previous version. The EditForm works perfectly.

...{ 
   name: 'Field1', 
   index: 'Field1' , 
   editable: true, 
   edittype:'select',
   editoptions:{
      dataUrl: 'lookup.dasl?EntityAttributeID=1345',
      value: {1:'ABC',2:'CDE',3:'EFG'}
   },
}...
A: 

WTF!!! Had to dig deep into the documentation for this one.

Just needed to add "formatter: 'select'"

AAAAAAAAAAAAAHHH!

Jan de Jager
A: 

I find non-logical that you use both dataUrl and value parameters of editoptions. I verified in both 3.7.1 and 3.6.5 versions of jqGrid in grid.common.js in the createEl function there are such code fragment:

switch (eltype)
{
    // ...
    case "select" :
        // ...
        if(typeof(options.dataUrl) != "undefined") {
            // ...
        } else if(options.value) {
            // ...
        }
        break;

So if you define dataUrl then value parameters of editoptions will be ignored.

UPDATED: The usage of formatter:'select' is not important for the question which you asked. If you send back in the response on dataUrl the values 1, 2 or 3 (the keys) instead of the values 'ABC', 'CDE' and 'EFG' then you should use formatter:'select'. If all cases the value parameter of editoptions will be ignored if you use also dataUrl.

Oleg
Awesome, Wasn't sure if the two were mutually exclusive.. Prefer using value param... Tx
Jan de Jager
I agree. If you knows statically the values, then the usage of `value` is more quickly as the usage of dynamic construction `dataUrl`.
Oleg