how to get the value in function

Questionshow to get the value in function
Chao Shun Jenq asked 11 years ago

Hi Abu,
****CODE1******

$col["name"] = "qty1";
$col["editable"] = true;

$col["name"] = "qty2";
$col["editable"] = true;

function test($data)
{
if ($data["params"]["qty1"]<$data["params"]["qty2"]) {phpgrid_error("error");}
}

****CODE2******

$col["name"] = "qty1";
$col["editable"] = true;

$col["name"] = "qty2";
$col["editable"] = false;

function test($data)
{
if ($data["params"]["qty1"]<$data["params"]["qty2"]) {phpgrid_error("error");}
}

********************
The CODE1 is work fine,but the CODE2 is not work.
Why I can not get the value of qty2 at CODE2 (using $data["params"]["qty2"] )??

Rgds,

4 Answers
Abu Ghufran answered 11 years ago

The reason for code2 is
$col["editable"] = false;

Non editable data is not posted by grid.
If you want it in function, you can make it editable->true, and keep it hidden.

You can also make another column with same column for display purpose.

$col["name"] = "qty2";
$col["editable"] = true;
$col["hidden"] = true;
..

$col["name"] = "qty2-temp";
$col["editable"] = false;

Chao Shun Jenq answered 11 years ago

Hi Abu
Thank for help!!
Rgds,

emman answered 10 years ago

Please how can I access the value of a col to use in a custom sql query
e.g.

$col["title"] = "School";
$col["name"] = "school";

….

$col["title"] = "Department";
$col["name"] = "department";
$schlquery = "select * from department WHERE schoolid='{school}'";

Is this possible?

I am using a paid version of the phpgrid

Abu Ghufran answered 10 years ago

I can't understand your query.
Please share code / screenshot. You can also email me at [email protected]

PS: Create a new ticket as it seems different case.

Your Answer

10 + 17 =

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?