I have been looking for some examples and solutions using the jquery-datatables-editable plugin and not had any luck. What I want to do is be able to set the editor for a column based on some identifier in that particular row. So for some rows a column may not be editable and other rows that column will have a select editor. I also need to have a column which always has a select editor which gathers data from a MySQL table but it will be filtered by a different parameter depending on the particular row.
Rough Example:
Col1 Col2 Col3 Col4
data1 null editor select editor select editor filter by 'a'
data2 select editor null editor select editor filter by 'b'
data3 select editor null editor select editor filter by 'b'
data4 null editor select editor select editor filter by 'a'
I gather the table data from a MySQL database and render the HTML table using PHP so I can use this to place an id or class on the row, or on the table cells to identify which scenario is needed for each row. I am not sure where and how to get and pass the information to customise the type of editor that is used.
I have tried to search for this information and have found a couple of forum discussions on the DataTables forum which may relate to what I need – here and here in the third paragraph. My problem is that while I’m not exactly clueless I’m not finding them easy to understand and adapt to my problem (this level of jQuery is new to me). I’m hoping that there is a simple-ish solution and that I’ve either been searching poorly or it is so simple and obvious that nobody else has had trouble doing it.
Well what i did was to put the class editable on the
tdi wanted to make editable and then i used a class selector like this to make them editable:you should use
classesfor things like this one and notids, because ids should be unique on the page