Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add formatting to grid groupField #100

Closed
ghost opened this Issue · 7 comments

4 participants

@ghost

jqGrid version 3.8.1.
jQuery version 1.4.3

What steps will reproduce the problem?
1. if one puts a formatter on the group field of grid , the same should get applied to the group title.

  1. the grouping seems to be happening before the formatter is applied. and that makes sense. But atleast once the grouping is done, the group text should be the formatted version.

What is the expected output? What do you see instead?
grouptext which currently can be of the form {0} - {1}
Here {0} should be the formatted version (if formatter is applied on group field)
Unformatted version of group field is currently seen.

@jrassa

This was added in jqGrid 4.0.0, but I think it needs to reverted/reworked. The problem is that the formatters defined in the column model accept as input 'cellvalue', 'options', and 'rowObject'. When a formatter is called from grouping code, there is no 'rowObject' associated with it and the grouping code passes in an array containing only the 'cellvalue'. Any formatters that rely on rowObject will not function properly.

As an example, I have a formatter that wraps the value in an anchor tag to make it clickable. It relies on the 'rowObject' to get an id that is needed to properly build the href value. When this formatter is called from the grouping code, 'rowObject' does not contain the id and it builds an bad link. I had to disable the use of the formatter on grouping to work around this.

A better solution may be to allow the user to define a groupFormatter on the colModel.

@healyje

I just ran into this with v4.4.0 which was reasonably unpleasant - has this since been addressed?

@meh-uk

I've partially addressed some of the issues here by allowing you to set a custom text column and a custom title column for the grouping header - that addressed the issues we had with groupings. Whether my solution is the best solution for the problems here is debatable, and I am more than happy to discuss it.

However I'm waiting for Tony to address the other four pull requests I have outstanding, which mysteriously he seems to be avoiding, before making a pull request in this area.

@healyje

I was trying to alter the column being grouped on by including information from another cell by way of the rowObject which obviously failed. It's still a use case I would be interested in so it would be nice to have it fixed.

@meh-uk

If you only want to include the content from the other column (with no other changes) and you are happy to run a patched version of jqGrid then you can try merging meh-uk@2738bc7

@healyje

Thanks, I'll take a look at that code and talk with our team.

@tonytomov
Owner

This already added

@tonytomov tonytomov closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.