custom events problem

Questionscustom events problem
santosh asked 5 years ago


See my code below. When I edit and save the record, my field is not modified.
Can you please help? thanks

$g = new jqgrid();

// set few params
$grid["shrinkToFit"] = false;
$grid["autowidth"] = true; // expand grid to screen width

$e["on_update"] = array("update_client", null, true);

function update_client($data)
$str = "UPDATE p_ozone SET modifier='foo'
WHERE id = {$data["id"]}";

3 Answers
santosh answered 5 years ago

what I am trying to do is when any field is updated I want another field updated to be updated with a variable from my code. In the above example I am trying to update the field with text 'foo'

Abu Ghufran answered 5 years ago

Your code looks fine. Check that first column name is 'id'. If not, change it to first column name.
You can always check what comes in $data array using:

function update_client($data)

// this would show $data in error msg.

$str = "UPDATE p_ozone SET modifier='foo'
WHERE id = {$data["id"]}";

Oscar answered 5 years ago

Same issue, when I insert or update a table, I can't get my PK called event_id (first column), in $data array I just obtain jqg1, and if I try again, jqg2 and so on. Please help. Thanks in advance.

Your Answer

11 + 14 =

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?