| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

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

Igor Antonov Jul 12, 2017 04:41PM PKT

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.

Up 1 rated Down
Abu Ghufran Jul 12, 2017 04:53PM PKT PHP Grid - Support Center Engineer
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.
Up 0 rated Down
Igor Antonov Jul 12, 2017 06:29PM PKT
Thank you.
it's worked nice


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

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

  • Post a Public Question
  • Email Us
  • Live Chat!
  • Ask the Community

    Instructions

    • Paste complete code that is involved in your question. You can use pastebin.com to share code link.

    Screenshots or Online link of webpage is helpful in resolution. You can also send email at address mentioned below.

    • To report an issue, Write steps to regenerate the case.

    • For email support or live chat, Use gridphp@gmail.com and add it in Google Chat.
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete