free-jqgrid: formatter: “Select” solving 'undefined' issue, but not showing expected data

孤人 提交于 2019-12-12 01:13:51

问题


Need a help on this please... I just now upgraded to free-jqgrid 4.13.6. Earlier I was using jqgrid 4.3

I am using below code and I see below as it is in picture. The difference here is in the first colModel (Review) I am using formatter: "select". In this case I am getting the value as "No" or "Yes". But when there is a null value, I am getting "undefined".

In second column (Status), I am NOT using formatter: "select". Here I am getting the value as "Y" or "N" and getting blank when it is null.

But I need the value to display as Yes/No and blank when the value is null.

Note: It was working fine in jqgrid 4.3

{name:'Review', width:85, fixed: true, align:'center', sortable: false, search: false, editable: true, resizable: false, stype:'select', formatter: "select", 
     edittype:'select', editoptions:{
         value:'Select:Select;Y:Yes;N:No',
         defaultValue:'Intime',
         multiple: false
     },
      searchoptions: {
         sopt: ['eq','ne'],
         value: 'Y:Yes;N:No',
         attr: {multiple: 'multiple', size: 2},
         dataInit: dataInitMultiselect
     }
 },
{name:'Status', index:'confirmationStatus', sortable: false, search: false, width: 80, fixed: true, align:'center', resizable: false, editable: true, stype:'select', 
     edittype:'select', editoptions:{
         value:'Select:Select;Y:Yes;N:No',
         defaultValue:'Intime',
         multiple: false
     },
     searchoptions: {
         sopt: ['eq','ne'],
         value: 'Y:Yes;N:No',
         attr: {multiple: 'multiple', size: 3},
         dataInit: dataInitMultiselect
     }
},

回答1:


You should fix the defaultValue:'Intime' in the column Review. You have to use the value, which is inside of values, which you define in value. I suppose it should be defaultValue:'N'.

I'd recommend you to take a look in the issue, where I describe some new features of the next version of free jqGrid, which you load already from GitHub. It uses sopt: ["in"]

stype: "select", 
searchoptions: {
    generateValue: true,
    //noFilterText: "Any",
    sopt: ["in"],
    attr: {
        multiple: "multiple",
        size: 4
    },
    dataInit: dataInitMultiselect
}

Try https://jsfiddle.net/OlegKi/3oeatxur/6/



来源:https://stackoverflow.com/questions/42216449/free-jqgrid-formatter-select-solving-undefined-issue-but-not-showing-expe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!