User Tools

Site Tools


jqgrid_hover

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

jqgrid_hover [2015/06/11 18:30] (current)
admin created
Line 1: Line 1:
 +I wanted to have a column of data gathered from a mysql timestamp type but didn't want to display the time in the jqgrid column, just the date.  Then I wanted to allow a user to see the entire entry, date and time, when hovering over a cell.  Here's one way to do it.  First create your column including the formatter attribute:
 +<​code>​
 +  colModel: [
 +                    {
 +                        name: '​memberid',​
 +                        index: '​memberid',​
 +                        hidden:​true,​
 +                    },
 +                    {
 +                        name: '​lastmod',​
 +                        index: '​lastmod',​
 +                        width: 65,
 +                        hidden:​true,​
 +                        formatter:​stripTime,​
 +                        sorttype: "​text"​
 +                    },
 +</​code>​
 +Then use something like this to format:
 +
 +<​code>​
 +function stripTime(cellValue,​options,​rowObject) {
 +    console.dir(rowObject);​
 +    var x= rowObject.lastmod.substring(0,​10);​
 +    return '<​span title="'​ + rowObject.lastmod+'">'​+ x +'</​span>';​
 +    return rowObject.lastmod;​
 +    return rowObject.lastmod.substring(0,​10);​
 +}
 +</​code>​
 +Show demo
 +
  
jqgrid_hover.txt ยท Last modified: 2015/06/11 18:30 by admin