manchiang / jquery-datatables-editable

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

Not using 'rel' attributes in AddRow form causes a really strange JQuery error and is very hard to debug #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Don't specify 'rel' attributes in the AddRow form
2. Outside of the form, add html like this - <tr><td>&nbsp;</td></tr>
3. Bring up an Add Row dialog, click ok.

What is the expected output? What do you see instead?

I expected the row to be added, but you'll see "Unexpected call to method or 
property access" instead.

What version of the product are you using? On what operating system?

1.3, IE8, Windows XP

Please provide any additional information below.

It's not clear that the 'rel' attribute is very important to Add Row.  When I 
didn't specify it, your code at line: 283 didn't find any input elements.  This 
caused 'oTRAdded' at line 303 to be null, and this was passed to applyEditable, 
and at line 222 then looks for ALL "td" elements in the HTML (parent object is 
NULL), and then when it hit my invalid <Tr><td> above, it then said "Unexpected 
call to method or property access".

So I have a request ;)

Either update your documentation page to indicate that 'rel' is a required 
attribute and MUST be specified.
Or change your code to warn if no inputs with a 'rel' attribute were found.

Original issue reported on code.google.com by cs94...@gmail.com on 4 Aug 2011 at 9:59

GoogleCodeExporter commented 9 years ago
Rubbish sample code to help:

if ( 
$("input:text[rel],input:radio[rel][checked],input:hidden[rel],select[rel],texta
rea[rel],span.datafield[rel]", oAddNewRowForm).length == 0  ) {
   properties.fnShowError("All fields in form '"+$(oAddNewRowForm).attr("id")+"' must specify the 'rel' attribute.  Aborting add.", "add"); 
   return;
}

Original comment by cs94...@gmail.com on 4 Aug 2011 at 10:44

GoogleCodeExporter commented 9 years ago
I just figured out this as well after stepping through the code and wondering 
why 'values' only had one element in it.

Original comment by aaron.we...@gmail.com on 5 Aug 2011 at 5:58

GoogleCodeExporter commented 9 years ago
Hi,

In the latest version of plugin there is a code that check is there some 
missing input fields in the add new row form.

Regards,
Jovan

Original comment by joc...@gmail.com on 21 Aug 2011 at 12:08