TypeError: val is null in for ( var j=0, jLen=val.length ; j
TypeError: val is null in for ( var j=0, jLen=val.length ; j
The function _fnSetObjectDataFn( mSource )
returns a function that can be used to set data from a source object, nevertheless it doesn't handle correctly the case when the value is null (val === null)
, which is a legitimate value. This can cause problems for function relaying on this function. One example is when Editor use this function to set the values Editor.prototype._submit
, if a user didn't select anything in a multiple value select, the value for this field is null. A very simple way (but probably not the most elegant) to solve this one is by ignoring a null value passed. I posted a PR in github:
https://github.com/DataTables/DataTablesSrc/pull/55
Replies
Hi,
I've posted a reply in the PR. I'm hoping to release 1.10.9 tomorrow - could you possibly let me know your thoughts on my replace and ideally supply a test case that shows the issue you are having, so if there is a change needed, it can be addressed in that release.
Thanks,
Allan
Well, it took me some time to construct the example, but there you have it:
1.Press New.
2.Press Create.
3.Watch the console ;)
http://live.datatables.net/lubasaga/1/edit
The question is where do you want to allocate the responsability of handling null values: in function
_fnSetObjectDataFn( mSource )
or in the components calling this function (like Editor). I say_fnSetObjectDataFn( mSource )
should really be able to set null value on nested sources.Thanks - I've added a reply in github.
Allan
4aee973 looks like a really robust fix. +1