Master-Detail Custom Error Message

QuestionsMaster-Detail Custom Error Message
edwardw asked 11 years ago

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

5 Answers
wain answered 11 years ago

Abu Ghufran whose function is to display the model view and where do I use the function into phpgrid

Abu Ghufran answered 11 years ago

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.

edwardw answered 11 years ago

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

Abu Ghufran answered 11 years ago

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; } }";

edwardw answered 11 years ago

Hi Abu
Thanks again. As usual your solution worked flawlessly!

Your Answer

14 + 2 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?