User Tools

Site Tools


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:

  colModel: [
                        name: 'memberid',
                        index: 'memberid',
                        name: 'lastmod',
                        index: 'lastmod',
                        width: 65,
                        sorttype: "text"

Then use something like this to format:

function stripTime(cellValue,options,rowObject) {
    var x= rowObject.lastmod.substring(0,10);
    return '<span title="' + rowObject.lastmod+'">'+ x +'</span>';
    return rowObject.lastmod;
    return rowObject.lastmod.substring(0,10);

Show demo

jqgrid_hover.txt · Last modified: 2015/06/11 14:30 by admin