Jan de Jager
Jan de Jager

Reputation: 870

JQGrid editOptions Values not working

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

Upvotes: 1

Views: 5724

Answers (2)

Oleg
Oleg

Reputation: 221997

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.

Upvotes: 2

Jan de Jager
Jan de Jager

Reputation: 870

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

Just needed to add "formatter: 'select'"

AAAAAAAAAAAAAHHH!

Upvotes: 2

Related Questions