Load record from a different table, and insert each record with Custom add button – Agent

QuestionsLoad record from a different table, and insert each record with Custom add button – Agent
Alphonse asked 9 years ago

How can i load data from one database table using grid, get this data plus one extra params and insert each record into a DB table using a custom button on one of the column

$col = array();
$col["title"] = "Register";
$col["name"] = "reg_status";
$col["width"] = "30";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
# no new line in this html, only space. otherwise it may break ui of grid
$buttons_html = "<input type='button' id= 'reg_btn' value='Register' onclick='add_client(this)'>";
$col["default"] = $buttons_html;
$cols[] = $col;

I want onclick Register button, it inserts the record within that row into a db table different from the one data was fetched from

1 Answers
Abu Ghufran answered 9 years ago

On this click event, you can pass the ID (pk) of this row using ajax call to a php script.
And in that script, do custom insert working.

You can pass the row data using {col-name} placeholder. e.g.

$buttons_html = "<input type='button' id= 'reg_btn' value='Register' onclick='add_client({ID})'>";
where 'ID' is your grid $col["name"] (case sensitive).

Your Answer

14 + 18 =

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?