manuelgtz / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

Cannot use aoColumns and a read_only class. Cannot make single cells read only and use textboxes, selectboxes and inline validation at the same time. #110

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make a server-side processed table editable using aoColumns and individual 
read_only cells.
2. Initialize makeEditable with aoColumns to have some columns default to 
read_only and some have input/select elements.
3. Add read_only class to rows through server-side processing

What is the expected output? What do you see instead?
What should happen is the rows that are set to read_only class shouldn't be 
editable. Likewise, the rows that AREN'T set to read_only should default to the 
settings configured in aoColumns.

What it's doing right now is it doesn't even recognize the read_only columns 
defined through the class. As it stands right now, you can only use aoColumns 
OR a read_only class which makes it impossible to do inline validation or 
select boxes if you want to use read_only on an individual cell basis.

What version of the product are you using? On what operating system?
I'm using the latest version. Windows 7 and Firefox but I've tested it in all 
browsers.

Please provide any additional information below.
aoColumns should be the default column properties. When someone puts a 
read_only class on one row or one cell, that specific row or cell should be 
read only. Right now in the code, it doesn't check each row or column for a 
read_only class if you set aoColumns in the initialization. I believe it's line 
219 where it starts. I think all you have to do is loop through all of the rows 
and check to see if a row is read_only and if it is, don't make the columns 
editable.. If it isn't, make the columns editable ACCORDING to what is defined 
in the aoColumns when calling makeEditable.

Original issue reported on code.google.com by mali...@gmail.com on 16 Apr 2012 at 8:44

GoogleCodeExporter commented 9 years ago
A few updates. The version that I was using was 1.3 when this happened. Now 
I've retrieved version 2.3.1 from the source code of the examples and the 
read_only class works if placed on the TD. On line 379 of version 2.3.1 it 
shows this:

if (!$(this).hasClass(properties.sReadOnlyCellClass)) {

I changed that line to this:

if (!$(this).hasClass(properties.sReadOnlyCellClass) && 
!$(this).parents('tr').hasClass(properties.sReadOnlyCellClass)) {

And it will prevent the entire row from being edited if the tr has the class.

The newer version 2.3.1 works perfectly for me and I've done extensive testing 
with it. Therefore, this issue can be changed to Fixed in the newest version if 
you'd like.

Original comment by mali...@gmail.com on 17 Apr 2012 at 4:30