Problem with phpgrid 2.6 and $col["formatter"] = "function(cellval,options,rowdata){…} option

QuestionsProblem with phpgrid 2.6 and $col["formatter"] = "function(cellval,options,rowdata){…} option
Alexander Toth asked 6 years ago

Hello Abu,
in these days I have migrated my application from phpgrid 2.2 to phpgrid 2.6 and and I noticed that some pages did not load with the 2.6 version
After a bit of testing I found that the problem are the columns with an option like this:

$col[“formatter”] = “function(cellval,options,rowdata){return rowdata.field001.replace(‘abc’,’123′)}”;

If the field field001 contains a NULL value, the grid doesn’t load (the grid freezes with Loading…) and in Firefox web console I get the error ‘TypeError: rowdata.field001 is null’

If I remove the replace method:

$col[“formatter”] = “function(cellval,options,rowdata){return rowdata.field001}”;

the grid load but show the value null in the column which is not pleasant to see (in phpgrid 2.2 is blank). Besides, I need to use the replace method to manipulate the output.

So there must be a difference on how the NULL value is treated betwheen phpgrid 2.2 and 2.6

I know thare there are workarounds, both in mysql and javascript, to handle NULL values, but I should change a lot of pages with this problem.
Please let me know if you can address this in your code.
Thanks!

2 Answers
Abu Ghufran Staff answered 6 years ago

We used latest JQGrid v4.7 JS opensource component in version 2.6 which may have some changes.

One solution is to replace following file from 2.2 to your current implementation and see if it work.

lib/js/jqgrid/js/jquery.jqGrid.min.js

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 6 years ago

We’ve done another fix in core lib to make null to “”. Emailed you update.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

4 + 10 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?