liul / jquery-datatables-editable

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

jquery-datatables-editable: server-side processing won't work with pre-populated data (iDeferLoading and aaData) #155

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello Jovan, 
great plugin you did here. I've being using it for a year.

I'm using datatables with server-side processing.
Recently I decided pre-filling the table with iDeferLoading and aaData 
parameters. So the initial loading of my page gets faster, since the client 
needn't do an ajax call to populate the table (at least a whole round trip time 
is saved!).

However, the first shown data won't be editable. The reason is here:

            if (oTable.fnSettings().sAjaxSource != null) {
                oTable.fnSettings().aoDrawCallback.push({
                    "fn": function () {
                        //Apply jEditable plugin on the table cells
                        fnApplyEditable(oTable.fnGetNodes());
                        $(oTable.fnGetNodes()).each(function () {
                                var position = oTable.fnGetPosition(this);
                                var id = oTable.fnGetData(position)[0];
                                properties.fnSetRowID($(this), id);
                            }
                        );
                    },
                    "sName": "fnApplyEditable"
                });

            } else {
                //Apply jEditable plugin on the table cells
                fnApplyEditable(oTable.fnGetNodes());
            }

I think the code in the "else" branch is needed in any case then. Doing this 
solved my problem. What do you think?

I'm using 

jquery.dataTables.editable.js 2.3.3
jquery.dataTables.js 1.9.4

Sincerely,
Franz-Josef

Original issue reported on code.google.com by franzjos...@gmail.com on 2 Aug 2013 at 12:11