$col['default'] – Not shoing value (Full Version)

Questions$col['default'] – Not shoing value (Full Version)
Craig asked 9 years ago

Version. 1.5.2

Hi there,

I have successfully implemented the grid how I require with the exception of setting a default value on a column.

Here is the code:

$col = array();
$col["title"] = "Download"; // caption of column, can use HTML tags too
$col["name"] = "dloptions"; // caption of column, can use HTML tags too
$col["width"] = "50"; // width on grid
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
$col["editable"] = false;
//$col["default"] = "<div><a href="{filepath}"><img src="/assets/images/download_icon.png"></a></div>";
$col["default"] = "Test";
$cols[] = $col;

I have also tried $col['editoptions'] = array("value" => "Test");

I've read the it's only available in the full version, which I have.

Can you please advise?

Cheers,

Craig.

5 Answers
Abu Ghufran answered 9 years ago

I just tested your column settings, are default value is displaying through out the column.
Please confirm that the included file jqgrid_dist.php on this page is not obfuscated (free version).

You can refer working demos in the package archive:
demos/appearance/custom-row-button.php

Craig answered 9 years ago

Thanks for the prompt response Abu.

Yes, using the paid version – non-obfuscated.

I am loading this through CodeIgniter returning an array passed to PHPGrid, but removing the framework and manually providing an array yields the same results. All other data, with the exception of the default fields appear correctly. Even dumping the dataset does not contain the "default" data.

I've run through the code and the "default" column tag only appears to be used in jqgrid_dist.php in both the Excel and PDF export sub-routines (lines 1957-1964 and 2437-2354). I cannot see how the replacement for "default" happens anywhere else. Also, if I export to either Excel or PDF the default value appears!

It seems strange to me that you are seeing the correct value – are we on the same version? I've just binary compared the 1.5.2 ZIP file to my working folder and apart from minor CSS alterations, everything is the same.

Cheers,

Craig.

Abu Ghufran answered 9 years ago

Ok, i got it now.

If you are loading grid with array, 'default' will not work.
You can set static values when setting that array.

e.g. demos/loading/load-array.php

$data[$i]['more_options'] = "<a class='fancybox' href='http://upload.wikimedia.org/wikipedia/commons/4/4a/Logo_2013_Google.png'><img height=25 src='http://ssl.gstatic.com/ui/v1/icons/mail/logo_default.png'></a>&quot;;

Craig answered 9 years ago

Ah.

Ok, gimme a sec and I'll test it out. Again, appreciate the prompt response.

Craig answered 9 years ago

Thanks for your help.

Instead of running another foreach over the array (which is passed as an array through CI from MySQL), I've just added a CONCAT() to the query and added the "download" field complete with the HTML embedded. Not as pretty as I'd like, but works!

Thanks for your help.

Cheers,

Craig.

Your Answer

10 + 20 =

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?