custom column and custom value

Questionscustom column and custom value
paago asked 10 years ago

pls how do i set custom column and value?

$col["name"] = "my own value not from database here";

another thing is i want to call a function passing the db column value as follows

$col["name"] = $this->getName('UID');
UID is the column on my db

another thing is how do i get the value from database and store in variable?

3 Answers
Abu Ghufran answered 10 years ago

I don't understand your query completely, I am answering what i guess the query is.

You can virtual column for custom data in grid, and fill that column using filter_display event.
e.g.

// virtual column to show grid

$col = array();
$col["title"] = "Id";
$col["name"] = "vid";
$col["width"] = "400";
$col["hidden"] = true;
$cols[] = $col;

$e["on_data_display"] = array("filter_display", null, true);
$g->set_events($e);

function filter_display($data)
{
$i=1;
foreach($data["params"] as &$d)
{
$d["vid"] = $i++;
}
}

Events, are supported in full version.

Ankur Garg answered 10 years ago

Hello,

This is not working. I want to add a column for Serial Number that having incremented value.
How to do that . Please help.

Abu Ghufran answered 10 years ago

You can set incremented serial no, using on_insert event.
In on_insert callback function, you can run a select query to fetch max serial number and set it incremented for insert.

Refer demos/editing/custom-events.php

Your Answer

19 + 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?