Hello,
I am using the paid version.
here a sample of my code
$col = array();
$col[“title”] = “FILE_NAME”;
$col[“name”] = “path”;
$col[“width”] = “100”;
$col[“default”] = “<a target=’_blank’ href=’/files/msds/{path}’><img src=’../../datagrid/images/mimetypes/pdf.png’ alt=’pdf’ width=’16’ height=’16’></a>”;
$cols[] = $col;
This works fine.
I would like to know if there is a way to check if the file exist within the grid. and display another logo is it does not exist.
Thanks,
1 Answers
Instead of 'default' property, you can use on_data_display event. Code will be like following: Refer demos/editing/file-upload.php line 118 for demo. $col["on_data_display"] = array("display_icon",""); function display_icon($data) { $path = $data["path"]; if (file_exists("/files/msds/".$path)) return "<a target='_blank' href='/files/msds/{$path}'><img src='../../datagrid/images/mimetypes/pdf.png' alt='pdf' width='16' height='16'></a>" else return "<img src='../../datagrid/images/mimetypes/not-found.png' alt='pdf' width='16' height='16'>" }
Your Answer