2
 {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].selectedIndex;
             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

Oleg
  • 220,925
  • 34
  • 403
  • 798
Scharlotte
  • 21
  • 1
  • 2

1 Answers1

2

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.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • because of your suggestion, i have default to recreateform - true. Is there anyway to still cache info in dataUrl to avoid having to reload that data every time you edit a row? – leora Feb 20 '14 at 00:08
  • @leora: I posted my answer on your question [here](http://stackoverflow.com/a/21901410/315935). – Oleg Feb 20 '14 at 07:49