Locking Rows based on a column value

QuestionsLocking Rows based on a column value
Daniel Behringer asked 8 months ago

First of all, great framework, I love to use it and to learn more and more of it. Thank you for your work making it.

This might be very easy questions, but how can I prevent row editing based on a column (called “locked”) value?

I have around 100 columns of data that must be displayed at all times, however, only the unlocked (no checkmark) rows should be accessible for editing and saving for the user.

3 Answers
Vygandas answered 8 months ago

Just add
$grid[“loadComplete”] = “function(ids) { do_onload(ids); }”

With JS function then disable checkbox like that (#jqg_list1_2212 is some id  or list1 f.e.):

function do_onload(id)
{
console.log(JSON.stringify(id));
$( “#jqg_list1_2212” ).prop(‘disabled’, ‘true’);
}

 

Abu Ghufran Staff answered 8 months ago

Please review column-access code. It connects on load, dblclick, select events with a callback function and disable rows based on certain row data.

Code: https://www.gridphp.com/demo/demos/editing/column-access.phps Demo: https://www.gridphp.com/demo/demos/editing/column-access.php

E.g. This code blocks editing if gender=male.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Dániel Behringer answered 8 months ago

Thank you for all the answers, especially yours Abu. I went through your code and figured out the best way to implement the edit prevention, and it works as intended!

Thank you again for your kind help, really appreciate it.

 

Cheers,

 

Daniel

Your Answer

7 + 7 =

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 5 / 5. Vote count: 1

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?