column ["link"] return empty when data loaded not from mysql

Questionscolumn ["link"] return empty when data loaded not from mysql
Igor asked 3 years ago

Hello,
i loaded data not from mysql:

$url="http://example.com/ip/func_iks.php";
$response = file_get_contents($url, false,stream_context_create($arrContextOptions));
$obj=json_decode($response,true);
$g->table = $obj;

$col = array();
$col["title"] = "Testtesttest";
$col["name"]="tab_id";
$col["width"]="40";
$col["editable"] = false;
$cols[] = $col;

This work perfectly.

But when i try add :
$col["link"] = "http://example.com/ip/sphinx.php?tabid={tab_id}";

i have empty value at {tab_id} column.

2 Answers
Abu Ghufran answered 3 years ago

The link property does not work with array based grid, and it's a known limitation.
You can iterate array data via for loop and change value of tab_id to html <a> tag instead of plain id.

Refer demos/loading/load-array.php … it uses hyperlink in grid.

Igor answered 3 years ago

Thank you.
it's worked nice

foreach ($obj as &$ex){
$query_url="http://example.com/ip/sphinx.php?tabid=&quot; . $ex["tab_id"];
$ex['tab_id'] = "<a class='fancybox' href='" . $query_url . "'>" . $ex['tab_id'] . "</a>";
}

Your Answer

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