Search code examples
jqgrid

how populate dropdwon jqgrid with button _click editoption


I am using form edit. There are three select boxes in the form. One select box is the country, I have a requirement to bind a jq grid combobox with data on click of a button iam use this code but i dont fill combo with editoptions dataEvents

{"name":"read",
"index":"read",
"width":48,
"resizable":false,
"editable":true,
"edittype":"select",
"editoptions":{
  "value":"0:0;1:1",
  "dataEvents":[{
               "type":"change",
                "fn":function(e){
                     if($(e.target).val() == '0')
                     {
                     // actions here...
                     }
                 }
               }]
 }

i want fill Dropdown with button click

   $('#myButton').click(function() {
          // Tell JQGrid to load new data
    });

Solution

  • iam sloved this problem this soultion

    function FillGridCombo(Idcol ,JsonStr,Idgrid) {
    
        $("#" + Idgrid).setColProp(Idcol, {
            editoptions: {
                 value:            
                jQuery.map(JsonStr, function (obj) {
                        result = new Array();
                        var jsonString = $.each(obj.Values, function (key, value) {
                            result[value.Value] = value.Display;
                        });
                        return (result);
                }),
            }
        });
    }