Hi Abu
In the master-detail scenario when adding a record to the detail grid I'd like to show an Custom Error Message stating that you can't add a detail record until you have selected a master record for it to be attached to. Do you have a suggestion?
Thanks
Abu Ghufran whose function is to display the model view and where do I use the function into phpgrid
In detail grid config … follow option will restrict addition unless parent is selected.
$opt["add_options"]["beforeInitData"] = "function(formid) { var selr = jQuery('#list1').jqGrid('getGridParam','selrow'); if (!selr) { alert('Please select master record first'); return false; } }";
where list1 is id of master grid.
Hi Abu
Thank you. This worked perfectly. I have an additional problem. In addition to wanting to have the error message popup I also have another function (use images for headers) that is executed in ["beforeInitData"]. How can I accommodate 2 functions?
Thank you
Hello,
In above js code, you can call as many function as you like. see fx,fx3,fx4 below.
$opt["add_options"]["beforeInitData"] = "function(formid) { var selr = jQuery('#list1').jqGrid('getGridParam','selrow'); if (!selr) { alert('Please select master record first'); fx2(); fx3(); fx4(); return false; } }";