$col["unformat"] with rowdata cause a loop

Questions$col["unformat"] with rowdata cause a loop
Alexander Toth asked 4 years ago

Hello Abu,
following your documentation I created a column like this:

$col = array();
$col[“title”] = “Map”;
$col[“name”] = “map”;
$col[“editable”] = true;
$col[“formatter”] = “function(cellval,options,rowdata){if (cellval == ‘default’){return ‘<a target=\”_blank\” href=\”map.php?gpx=’ + rowdata.ID + ‘\”>’ + ‘map_link</a>’;} else {return ‘<a target=\”_blank\” href=\”‘ + cellval + ‘\”>’ + cellval + ‘</a>’;}}”;
$col[“unformat”] = “function(cellval,options,cell){var rowdata = jQuery(‘#list1’).getRowData(options.rowId);return rowdata[‘ID’];}”;
$cols[] = $col;

The formatter part works properly, the problem is with the col[“unformat”]: when I try to edit a record the browser freezes and after a few seconds a popup comes out (“A web page is slowing down your browser. what would you like to do”).

To investigate I replaced return rowdata[‘ID’] with alert (rowdata[‘ID’]). In this way it comes out a javascript popup with the correct ID value, but when I close the popup, the same popup reopens countless times…it is clear that there is a kind of infinite loop.

Thanks

1 Answers
Abu Ghufran Staff answered 4 years ago

Hi, I’ve regenerated this issue and it does not seems to work with unformat + getRowData function.

An alternate is to use: getCell, e.g. following will read gender column cell data.

$col[“unformat”] = “function(cellval,options,cell){ var r = jQuery(‘#list1’).jqGrid(‘getCell’, options.rowId, ‘gender’); return r;}”;

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

16 + 6 =

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?