Hi Team and Friends!
Could you be so kind to assist me in how can I set the ToolTip feature for individual cells based in other field of my database
for example, I have to fields for a product.
Stocks and Sales
I want to show Stocks in a cell and the Sales in a tooltip for this product (in this cell showing stock)
Thanks you in advance.
You can set custom formatter to set custom tooltip (title attr).
For e.g. if you want to have cell with tooltip of column 'company', then formatter would be:
$col["formatter"] = "function(cellvalue, options, rowObject){ return '<div title="'+rowObject.company+'">'+cellvalue+'</div>'; }";
Unformat function will also be required for editing raw text:
$col["unformat"] = "function(cellvalue, options, rowObject){ return jQuery.jgrid.stripHtml(cellvalue); }";
Column settings:
$col = array();
$col["title"] = "Company";
$col["name"] = "company";
$col["editable"] = true;
$col["edittype"] = "textarea";
$col["editoptions"] = array("rows"=>2, "cols"=>20);
$cols[] = $col;
$col = array();
$col["title"] = "Client Name";
$col["name"] = "name";
$col["formatter"] = "function(cellvalue, options, rowObject){ return '<DIV title="'+rowObject.company+'">'+cellvalue+'</DIV>'; }";
$col["unformat"] = "function(cellvalue, options, rowObject){ return $.jgrid.stripHtml(cellvalue); }";
$col["editable"] = true;
$col["width"] = "80";
$cols[] = $col;
Full code: http://pastebin.com/ENKjryJ1