Disable a row based off of data
Disable a row based off of data
Hi Guys,
I have been looking for the proper way to disable or make read-only a row if it matches my criteria. So for example I have a form that will submit the pricelistid to the where clause and only returns the data that matches.
->where($key = "pricelistid",$value = $pricelistid,$op = '=')
What I would like to do is rather than filter them out with a where clause I would like to return all the rows but only allow rows that match a criteria to be edited. Still show the others but don't allow them to to be edited. If i was building the table manually I would use a variable that would pass a disable on the input field. Can this be done in datatables editor?
Thanks
Mike Mason
Answers
Somewhere in your code you are applying in on click event that triggers Editor, right? If so, add a class to the rows that should be read only and then use that as a way to remove the on Click event or whatever class you are using to assign the click event.
In my case, I have inline editing on 3 columns. They get a class added call "dt-edit".
I make them clickable with this (I call this on the dt.draw event):
and set some to read only with this.
"dt-edit-select" is a class I put on one column that determines if it should be read only. Items that are "N/A" are read only.
Perfect. Thanks I will give this a go.
Thanks
Mike Mason