jqGrid edit using formedit disable fields based on value of another field

前端 未结 1 699
长情又很酷
长情又很酷 2021-01-25 21:02

When the user clicks on Edit in jqGrid, the form which opens has a few list boxes and text boxes. Depending on the value in a List box a couple of text boxes have to be disabled

相关标签:
1条回答
  • 2021-01-25 21:51

    I see many ways which you can go to implement your requirements.

    The first and the best one in my opinion would be the usage of dataEvents of the editoptions with the type:'change' (see this answer as an example). The corresponding code can be

    editoptions: { dataUrl:...,
                   dataEvents: [
                       {
                           type: 'change',
                           fn: function(e) {
                                var v=$(e.target).val();
                                alert(v); // do something with selected item value
                           }
                       }
                   ]
                 }
    

    The binding to the functions defined by dataEvents will be after the successful return of the select contain from the server.

    Another way would be modify your current implementation so that you replace jQuery.bind to jQuery.live (see a code template here).

    0 讨论(0)
提交回复
热议问题