Conversion of field value in grid

QuestionsConversion of field value in grid
Jonathan asked 1 month ago


I am converting a field value for display in a grid (converting from lbs to kg with a small function) in the grid set events/filter display section  e.g.:

function filter_display($data);
foreach($data[“params”] as &$d)
// for each row, convert the retrieved amounts from LBS to KG
$d[“BlockFuel”]= convertlbstokg($d[“BlockFuel”]);
$d[“Cargo”]= convertlbstokg($d[“Cargo”]);
etc etc.

The grid is set to be editable, so whenever I edit a row value it saves the fuel and cargo values back as kg (i.e. the converted value) when it should be in lbs. I can write a function to convert the values back to lbs but where in the code flow can I do this? I can’t see where it updates the tables with edited grid values.

1 Answers
Abu Ghufran Staff answered 1 month ago


This code can be added in on_update event handler. And call similar conversion before it is inserted in database.


If the 3rd argument is true, the function will behave as a data filter and the final update will be done by grid code.

$e["on_update"] = array("update_client", null, true);
function update_client(&$data)
    // set current date time internally
    $data["params"]["BlockFuel"] = convertkgtolbs($data["params"]["BlockFuel"]);
Abu Ghufran - Dev Team
Grid 4 PHP Framework
Your Answer

20 + 15 =

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?