开发者

beforeShowForm jqgrid in dynamic form

 {edit:true,add:true,del:false,search:false,refresh:true,view:false} ,
 // edit option
 {  
     beforeShowForm: function(formID) {    
         //alert("TESTALERT");
         jQuery('#tr_b_summe_cvvp', formID).show();
         jQuery('#tr_b_summe_lsv', formID).show(); 
         jQuery('#buchung', formID).click(function() {
             var index = $(this)[0].selectedInde开发者_C百科x;
             if (index == 1)      {   jQuery('#tr_b_summe_lsv',  formID).hide();  }
             else if (index == 2) {   jQuery('#tr_b_summe_cvvp', formID).hide();  }
             else if (index == 3) {   jQuery('#tr_b_summe_cvvp', formID).show();  }
             else if (index == 4) {   jQuery('#tr_b_summe_lsv',  formID).show();  }
         });                            
     }
}, 

I want to make a "dynamic" form with jqgrid. When alert() is in use, the form works well, if not the dynamic change of rows only work in the second attempt


I would recommend you to use recreateForm:true option. In my opinion the setting should be default option of the jqGrid form editing.

The problem is that with the default settings recreateForm:false jqGrid create the form only once, so only at the first time the function beforeShowForm will be called. Moreover if you use both Add and Edit forms only one form for both dialogs will be created. Then the dialog will be only hide or shown. It makes some very strange effects. So I strictly recommend all to always to use recreateForm:true option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜