I can't see image column on the grid.

QuestionsI can't see image column on the grid.
Jack asked 2 years ago
I can't see image column on the grid. 

I wrote this :$col["show"] is array and almost true

My code is here:

// file upload column
$col = array();
$col["title"] = "Image";
$col["name"] = "image";
$col["width"] = "50";
$col["align"] = "left";
$col["edittype"] = "file";
$col["editable"] = true;
$col["search"] = false;
$col["upload_dir"] = "../uploads/suppliers"; // upload here
$col["sortable"] = false;
$col["align"] = "center";
$col["formatter"] = "function(cellval,options,rowdata){ return '<img src=\"'+cellval+'\" height=60 />'; }";
$col["unformat"] = "function(cellval,options,cell){ return $('img', cell).attr('src'); }";

$col["editrules"]["allowedext"] = "png,gif,bmp,jpeg,jpg,doc,xls,docx,xlsx"; // comma separated list of extensions
$col["editrules"]["allowedsize"] = 3 * 1024 * 1024; // allowed size in bytes e.g. 3 MB = 3 x 1024 x 1024

$col["show"] = array("list"=>true,"edit"=>true,"add"=>true,"view"=>true);
$cols[] = $col;
1 Answers
Abu answered 2 years ago

The file upload column is only shown on add/edit dialog.

To display image, You need to have another virtual column which shows image.

Refer this code: https://www.gridphp.com/demo/demos/editing/file-upload.phps line 110

Your Answer

3 + 12 =

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?