View Full Version : grouping view header template being rendered before store load event???????

Tim Toady
30 Apr 2010, 7:37 AM
My goal: Trying to determine whether the group is the first or last group in the groupTextTpl

UPDATE: I found my bug. I was setting the lowest/highest catOrder to an int and the json that comes back for the catOrder was a string. Since javascript is weakly typed it kept chugging along happily and I had no idea. I simply put a parseInt in the template and it was solved. I am still open to a more elegant solution though.

I don't care how I reach the goal as long as I can know whether the group is the first or last when I am in its grouptexttpl because I need to do something different for both those cases. It doesn't have to be the same way as I am attempting as long as it works. My way is very ugly and I would much prefer a more elegant solution.

My failing attempt:

I have come across an issue I that I am not sure how to fix. I have a groupingview with a groupTextTpl that is set like this.

groupTextTpl: '{text} <div class = "{[(values.rs[0].data.lowestCatOrder != values.rs[0].data.categoryOrder) ? "groupUp" : "hiddenGroup"]}">Up</div> <div class = "{[(values.rs[0].data.highestCatOrder != values.rs[0].data.categoryOrder) ? "groupDown" : "hiddenGroup"]}">Down</div>',
What I am doing is I want to set a divs class to hiddenGroup if it has the lowest categoryOrder, otherwise set it to groupUp.
I also want to show groupDown except when it is the highest categoryOrder.

I set the data.lowestCatOrder and data.highestCatOrder in the load event of the groupingstore. But it seems like the load event happens after it is rendered because when it is first loaded hiddenGroup isn't the class for the highest or lowest group. When I do a gridView().refresh it works properly.

I cannot find anywhere where I can do a refresh in the code. When I try to do a grid.getView().refresh in the load event for the store the post aborts. If I do it elsewhere it doesn't appear to work. The only way I can get it to work is if I do a refresh in firebug after I load the store.

Any ideas/insight would be appreciated.