Hi,
Why the definition below doesn't work?
$col["condition"] = array('$row["deb"] = 0', '', $row["deb"]);
I want display nothing ('') if cell 'deb' is equal to 0 and display it when greater than 0.
Thank you!
Instead of =, try ==
$col["condition"] = array('$row["deb"] == 0', '', $row["deb"]);
Now, it returns empty ('') in all cells (second parameter $row["deb"] doens't return nothing).
Thank you!
The 2nd and 3rd argument are html content, in which you can use placeholder for col names.
$col["condition"] = array('$row["deb"] == 0', '', '{deb}');
Sir,
Please, the 3rd argument could to be a javascript function with colname parameter? For example: 'validateField({deb})'
Thank you!
It can only be html code. You can use something like <a href='return void()' onclick='alert(2323)'>{deb}</a>.
I need help to integrate conditional content for extended options with callback functions
Hello Jesus,
For conditional content, please refer demo/editing/conditional-data sample.
Please email me your scenario, what exactly are the options you are looking for.
Regards,
Hi,
In condition can we add SQL QUERY like I want to check does that auto incremented ID exists in last three entries for that respective row's customer/user. Please let me know how can we do that.
I tried this but its giving me error in demo.
$col["condition"] = array('$row["id"] IN (SELECT id FROM invheader ORDER BY id desc limit 3)', 'DELETE','');
Hop this will clear you requirement, I want to give delete link to last three transactions of each customer
Please let me know as early as is it possible or not.
Thanks
Jayashri
You can run this SQL and replace the result in condition.
for e.g.
$arr = array();
$q = mysql_query('SELECT id FROM invheader ORDER BY id desc limit 3');
while($rs =mysql_fetch_assoc($q))
{
$arr[] = $rs["id"];
}
$col["condition"] = array('$row["id"] == '.$arr[0].' || $row["id"] == '.$arr[1].' || $row["id"] == '.$arr[2], 'DELETE','');
Check for typos and this is not executed.
Actually problem is we need client_id of each row
$col["condition"] = array('$row["id"] IN (SELECT id FROM invheader WHERE client_id=$row["client_id"] ORDER BY id desc limit 3)', 'DELETE','');
I want to give delete link to last three transactions of each client, so if client_id = 1 then give delete link to its latest 3 transactions only.
I think its not possible as mysql is giving error "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery"
Let me know if you have any idea to get the solution.
Thanks in advance
For extended conditional data, you can also have callback function, that will allow you to display based on row data. For e.g.
$col["on_data_display"] = array("display_keyword","");
function display_keyword($data)
{
$kw = $data["keyword_name"];
$numKeywords = count(explode("n",$pass));
if ($numKeywords > 3)
return $numKeywords." Keywords";
else
{
$pass = str_replace("+"," ",$pass);
return $pass;
}
}
Hi Abu,
$col["condition"] = array('$row["note"] == "No Bill"', "No Bill", "<a href='$upload_url/{note}'class='fancybox' data-fancybox-type='iframe'>Bill (Click Here)</a>");
in the above code it show column value equal to No Bill it display No bill otherwise it display Bill (Click Here) link.
Now i need another option to add "Need To Scan" in it how can i do this
Thanks,
P.Navaneethan
Hi Abu,
$col["condition"] = array('$row["note"] == "No Bill"', "No Bill", "<a href='$upload_url/{note}'class='fancybox' data-fancybox-type='iframe'>Bill (Click Here)</a>");
in the above code it show column value equal to No Bill it display No bill otherwise it display Bill (Click Here) link.
Now i need another option to add "Need To Scan" in it how can i do this
Thanks,
P.Navaneethan
Hi Abu,
$col["condition"] = array('$row["note"] == "No Bill"', "No Bill", "<a href='$upload_url/{note}'class='fancybox' data-fancybox-type='iframe'>Bill (Click Here)</a>");
in the above code it show column value equal to No Bill it display No bill otherwise it display Bill (Click Here) link.
Now i need another option to add "Need To Scan" in it how can i do this
Thanks,
P.Navaneethan
Hi Navaneethan,
Refer docs for extended conditional content.
http://www.phpgrid.org/docs/#Conditional_Content
Basically you can call callback function to render the content.
$col["on_data_display"] = array("display_keyword","");