PDA

View Full Version : is there a sortType alternative for GroupingView?



McCurly
8 Apr 2010, 6:04 AM
Hi all,
I am a bit new to Ext-js, so have mercy on me pls

I want to use gridview in the GridPanel and my 2D array (store) contains elements like these:
element = '{
tlcode: -2,
tooltip: "View Integrity Details",
sortvalue: 4.0,
celldata: "<div style=\'width:50%; float:center\'>some html </div>"
}'

To explain above - this is a string, which contains a JSON object/structure inside.

now, I can do what I want with sorting the table by specifying sortType in store
= {... fields: {name:"blah", storeType: function(val){...} } }

and I can deal with rendering by specifying custom function in the column =
{ ... renderer: function(val, meta, rec, row, col, ds){....} ...}

Inside those functions I call eval(...) and extract attributes I need to sort and render the data. The sorting function returns element.sortvalue attribute which is a number and rendering function returns element.celldata attribute which is a string full of HTML tags, links images, etc. All is well here and I am happy.

Now when It comes to Ext.grid.GroupingView, I can handle the appearance of my group text title (...just, there are issues with divs, but I'll get there eventually), and that's by specifying groupRenderer in the column
= {...groupRenderer : function(...), ...}
however I want my rendering to be different from sorting, as you can see from the earlier example. But there is nothing like grouSortType in store, or column or anywhere :((

If I set groupRenderer function to something simple, say to return element.sortvalue then grouping works fine but grouping text shows a number instead of some prety html. So my question is how can my grouping in the table use element.sortvalue attribute of the element in the store and my rendering of the group title use something else.

I use groupingstore instead of arraystore of course.

Sorry for long explanation, and if it's been solved before, just point me to the link. my search yielded some interesting results on GroupingView problems but not what I am looking for.

McCurly
9 Apr 2010, 1:05 AM
OK, let me rephrase it, since my first post was not attractive enough.

How the hell do I group rows/records in the grid if those rows/records contain JSON objects. or some heavy HTML formatted string. it appears that grouping does not function correctly, as it groups each record in its own group which is incorrect.

any thoughts? pls see my above post for more detail. thanks

McCurly
15 Apr 2010, 2:21 AM
hmm, I must be doing something wrong here, 31 reads no replies. Oh well...

McCurly
4 Jun 2010, 10:32 AM
OK, found a workaround. happy for now. great response guys, thanks to all who helped (sarc)...