PDA

View Full Version : [INFOREQ][3.??] GridFilters Plugin updateColumnHeading broken in SVN



Mjollnir26
15 Jan 2010, 1:06 AM
One thing i noticed during upgrading an internal EXT-Application from 2.2.1 to 3.1 (SVN-TRUNK from 2 days ago) is that the small Feature where a Grid
with the Filter Plugin should update it's column header (make it bold and italic) as seen on the Examples Page

http://www.extjs.com/deploy/dev/examples/grid-filtering/grid-filter-local.html (http://www.extjs.com/forum/../deploy/dev/examples/grid-filtering/grid-filter-local.html)

doesn't work.
The Code in Question is the "updateColumnHeadings" Method in the GridFilters.js
It boils down to the following "select" Call finding way to many and wrong elements:


hds = view.mainHd.select('td').removeClass(this.filterCls);

Evaluating the Results in Firebug showed me that query finding every td element in the whole damn grid, which in turn lead to the "filterCls" being applied to the tbar of the grid instead of the Header. The Code for this method on the Examples-Page and in SVN is identical though, so it must be some gotcha in the select-Method?

Here's a little patch that makes the feature work again, but doesn't correct the supposed underlying problem:


hds = Ext.select('td.x-grid3-hd', view.mainHd).removeClass(this.filterCls);

Condor
15 Jan 2010, 1:56 AM
See this thread (http://www.extjs.com/forum/showthread.php?p=411620#post411620).

Mjollnir26
15 Jan 2010, 2:08 AM
So was it my fault thinking that calling ".select" on an element would only find children of this element?

view.mainHd is the header-element and in my case there where waaaayyy to many td-elements found by the query. I thought that would be the main problem?

Condor
15 Jan 2010, 2:16 AM
So was it my fault thinking that calling ".select" on an element would only find children of this element?

view.mainHd is the header-element and in my case there where waaaayyy to many td-elements found by the query. I thought that would be the main problem?

parent.select('td') will find all td children (at all levels) of the parent element.

The problem is that some plugins (like group headers) add extra td elements to the header.

Mjollnir26
15 Jan 2010, 2:24 AM
This is from my Firebug-Log showing the same query as in updateColumnHeaders.

There are 1755 Elements found, MOST of them reside in the BODY of the GRID

These are cells with data in it, i double-checked that in Firebug.
But view.mainHd is only a wrapper for (one or many headers), i also checked that.
So i still think that the view.mainHd.select('td') really really finds way too much...

>>> Ext.getCmp('logDG')
Object initialConfig=Object split=true region=north
>>> Ext.getCmp('logDG').getView()
Object id=logDGGroupView
>>> Ext.getCmp('logDG').getView().mainHd
Object dom=div#ext-gen59.x-grid3-header id=ext-gen59
>>> Ext.getCmp('logDG').getView().mainHd.select('td')
Object elements=[1755] el=Object isComposite=true

Mjollnir26
15 Jan 2010, 2:26 AM
Oh and BTW no GroupHeader plugin, but a groupinggridview...?
But the original sourcecode applied the filter-cls to the Toolbar...maybe this is incorrect too?

Other than that, thanks for ur quick response, and thanks to the Team for the 3.1 release... it's really great.

Condor
15 Jan 2010, 2:51 AM
Are you sure your Ext SVN build is correct? I don't see the select returning all tds from the document.

Mjollnir26
15 Jan 2010, 3:58 AM
Hmm i'll strap a testcase together when i have time and upload it here....