djavaui / jquery-datatables-editable

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

Problem with add when array of objects is used in SS processing mode #67

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. add new row via modal popup window

What is the expected output? What do you see instead?
I expect to get a success notice but I get an error "DataTables warning (table 
id = 'usertable'): Requested unknown parameter 'id' from the data source for 
row 4"

the unknown parameter is always the title of the first column in datatable.

I had the problem before when only editing rows inline and it was fixed by 
adding aoColumns to the datatable() but this isn't helping for the add new row 
function.

What version of the product are you using? On what operating system?
jquery.dataTables.editable.js 1.3
jquery.dataTables.js 1.8.2
jquery 1.4.4

Please provide any additional information below.

Original issue reported on code.google.com by jpwdesi...@gmail.com on 25 Sep 2011 at 12:17

GoogleCodeExporter commented 8 years ago
forgot to mention, even though i'm getting an error, the row is being added 
successfully and after closing the error window the table is refreshing and 
including the new row.

Original comment by jpwdesi...@gmail.com on 25 Sep 2011 at 12:18

GoogleCodeExporter commented 8 years ago
By the way, thank you so much for sharing this project!

updated to jquery.dataTables.editable.js 2.0.2
still same issue. More detail of my code here:
http://www.datatables.net/forums/discussion/6736/requested-unknown-parameter-aft
er-add-new-row#Item_1

Original comment by jpwdesi...@gmail.com on 25 Sep 2011 at 4:52

GoogleCodeExporter commented 8 years ago
Hi,

Is there any online example I can see. It is hard to guess what is wrong. 

Jovan

Original comment by joc...@gmail.com on 25 Sep 2011 at 6:13

GoogleCodeExporter commented 8 years ago
Hi Jovan, thanks for the reply.

I can give you login access to the site to take a look but I need to send it to 
your email so that it's not public. can you email me at jpwdesigns at gmail?

Original comment by jpwdesi...@gmail.com on 25 Sep 2011 at 6:45

GoogleCodeExporter commented 8 years ago
This is what seems to be giving me trouble:

                //Add values from the form into the table
                var rtn = oTable.fnAddData(values);
                var oTRAdded = oTable.fnGetNodes(rtn);

oTable.fnGetNodes(rtn) isn't working for me. any thoughts?

Original comment by jpwdesi...@gmail.com on 27 Sep 2011 at 5:22

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok so i commented out the following:

//                //Add values from the form into the table
//                var rtn = oTable.fnAddData(values);
//                var oTRAdded = oTable.fnGetNodes(rtn);
//                //Apply editable plugin on the cells of the table
//                fnApplyEditable(oTRAdded);
//                //add id returned by server page as an TR id attribute
//                properties.fnSetRowID($(oTRAdded), data);
//
//                $("tr.last-added-row", oTable).removeClass("last-added-row");
//                $(oTRAdded).addClass("last-added-row");

and added on the page 
fnOnAdded: function() {
     oTable.fnDraw(false);
},

Works well so far. bummed i couldn't figure out what the issue is. 

Original comment by jpwdesi...@gmail.com on 27 Sep 2011 at 6:06

GoogleCodeExporter commented 8 years ago
Hi,

Could you take a version 2.0.3 and try it again. You can remove your 
\fnOnAdded: function() {
     oTable.fnDraw(false);
},
code.

Thanks,
Jovan

Original comment by joc...@gmail.com on 27 Sep 2011 at 10:46

GoogleCodeExporter commented 8 years ago
Hi, I'll try it tonight. Thank!

On Tue, Sep 27, 2011 at 5:46 PM,
<jquery-datatables-editable@googlecode.com>wrote:

Original comment by jpwdesi...@gmail.com on 27 Sep 2011 at 10:50

GoogleCodeExporter commented 8 years ago
Hi i added 2.0.3 and removed the fnDraw(false).

Adding rows works perfectly!

2 other issues seem to be still persistent.

   - Deleting a row does not refresh table. I have to resort to the
   onDeleted fnDraw(false) call on the page.
   - Editing a row redraws table (calls the external json file)

I suspect that both issues are related.

Thanks again.

Jeremy

Original comment by jpwdesi...@gmail.com on 28 Sep 2011 at 1:41

GoogleCodeExporter commented 8 years ago
Hi Jeremy,

I will take a look at the delete. Problem is that when i have switched from 
DataTable 1.7 to 1.8 i have not checked all new features. Probably this is 
similar issue as on add.

Regarding the refresh on edit this is "known issue" see issue 15. When you 
change the cell content, if table is already sorted by this column position of 
edited row should be changed. Also, if some filter is applied and if you change 
content of the cell so filter is not satisfied anymore row most be removed from 
the current page. There are several other cases where Datatable need to 
determine position of the modified row and this required refresh if it works in 
the server side mode. I could not cover all possible 

Note that now on each add table is refreshed too. This is done because when new 
row is added DT needs to refresh itself in order to determine position of the 
new row. If you are sorting it by id desc, in that specific case it should 
always come at the start, but generally if the table is sorted by other columns 
added row might be positioned on some other page.

Regards,
Jovan

Original comment by joc...@gmail.com on 28 Sep 2011 at 9:40

GoogleCodeExporter commented 8 years ago
Hi Jovan,

Excellent work on this.

Ok I understand about edit. I suspect as you that the delete issue could be
related to the add issue.

Thanks again.

Jeremy

On Wed, Sep 28, 2011 at 4:40 AM,
<jquery-datatables-editable@googlecode.com>wrote:

Original comment by jpwdesi...@gmail.com on 28 Sep 2011 at 5:41

GoogleCodeExporter commented 8 years ago
Hi,

I have checked this on the test site and delete works. However, in the delete 
handler you have returned "Message Deleted" string, and plugin think that this 
is error message.
Instead of this could return just "ok" (see examples/wiki).

Also, It seems to me that there is some error in the server side page that 
provides data. When plugin calls it it just returns "false" and DT is in the 
processing mode.

I will close this issue because original problem with add is resolved. If there 
are other problems with delete could you raise it as a separate issue?

Thanks,
Jovan

Original comment by joc...@gmail.com on 29 Sep 2011 at 7:33

GoogleCodeExporter commented 8 years ago
Hi Thanks.

I did a test by switching delete output to ok. Then removing my call to 
fnDraw(false).
the result was that the row is deleted and the datatable is refreshed but to 
the wrong page.

Example, if i have 65 rows, and on page 7 showing the last 5 rows, and delete 
any one of those last 5, the row is deleted but the table is reloaded to page 
6. Seems like the page calculation is a little off still.  I'll leave the page 
this way so you can see it.

Thanks,

J

Original comment by jpwdesi...@gmail.com on 29 Sep 2011 at 3:19