ktm5124
ktm5124

Reputation: 12123

jqGrid 4.5.2 - formatting bug

We recently upgraded from jqGrid 4.4.1 to jqGrid 4.5.2 and noticed that some of our cell formatting is no longer working.

We previously had a formatter function defined as

function addEllipsis(cellvalue) {
    return '<div class="ellipsis" title="' + cellvalue + '">' + cellvalue + '</div>';
}

We would use this in our colModel, for example,

colModel = [
{
  name: "longText",
  label: "longText",
  formatter: addEllipsis
},
...
]

However, the formatter is no longer working - the ellipsis is not being added to the cells. When I downgrade to jqGrid 4.4.3 it works fine. But upgrading to >= 4.5.2 causes the ellipsis to go away.

Is this a bug in the 4.5 releases?

Update: Here is the CSS for the ellipsis class.

.ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    -moz-binding: url('assets/xml/ellipsis.xml#ellipsis');
}

Upvotes: 0

Views: 154

Answers (1)

Oleg
Oleg

Reputation: 221997

I would implement ellipsis in jqGrid in a little other way. In the old demo created for the answer I used more specific CSS rule which allows to place ellipsis in all columns of the grid.

The new demo uses classes: "ellipsis" property in colModel. It allows to places ellipsis class on <td> elements of specific columns. I used the CSS rule

.ui-jqgrid tr.jqgrow td.ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
}

The main advantage of the approach: you don't need to use custom formatters. In the demo I combined formatter: "date" with classes: "ellipsis" and you can see the following picture as the result

enter image description here

So I don't think that the described problem is a bug in jqGrid 4.5.2. I think that you should just adjust your CSS rule and remove custom formatter which you use currently.

Upvotes: 1

Related Questions