Open meterlongcat opened 7 years ago
Instead of !$.isArray(tmp)
could instead test if tmp
is a string. That's probably a better solution rather than trying to exclude all of the types that happen to have a length
property.
Thanks, checking for string is better. Just curious - can you please provide a simple demo when this happen?
Thank you.
Kind Regards, Tony
I just tried putting together a jsfiddle, however the only version of jqGrid available via CDN is 4.6. Do you know how I can reference 5.2.1?
Sorry for this. I hope CDN will be available in couple of days. For now use rawgit here is the link: https://cdn.rawgit.com/tonytomov/jqGrid/v5.2.1/js/jquery.jqGrid.js
Thank you
Kind REgards
Hi,
I've just written a custom
formatter
andunformat
for a property containing a JavaScript array. Unfortunately this breaks with the jqGrid when the array is non-empty, more specifically when the array is of length 1.The cause is this line of code:
if(tmp === " " || tmp === " " || (tmp.length===1 && tmp.charCodeAt(0)===160) ) {tmp='';}
As you can see the
tmp.length===1
test will evaluate to true, causingcharCodeAt
to be called on an array which does not exist.Should be able to fix this by changing to:
if(!$.isArray(tmp) && (tmp === " " || tmp === " " || (tmp.length===1 && tmp.charCodeAt(0)===160)) ) {tmp='';}
Kind Regards, Jan