-
15 Aug 2009 6:37 PM #11Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,067
- Vote Rating
- 96
- Answers
- 166
Another way to do it without filter:
Code:Ext.select('a').each(function(el){ if(el.dom.hostName != location.hostName){ el.addClass('external'); } });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
15 Aug 2009 11:29 PM #12Sencha - Ext JS Dev Team
- Join Date
- Mar 2007
- Location
- Notts/Redwood City
- Posts
- 30,458
- Vote Rating
- 20
- Answers
- 9
In its current form where it filters using a string selector as the parameter, or will it be upgraded to accept a selection function in addition?
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
16 Aug 2009 1:58 AM #13
What about this jQuery-Code?
Highlight all of the cells following the one containing Henry (include the one that contains Henry)PHP Code:$('td:contains(Henry)').nextAll().andSelf().addClass('highlight');
-
16 Aug 2009 2:25 AM #14Sencha - Ext JS Dev Team
- Join Date
- Mar 2007
- Location
- Notts/Redwood City
- Posts
- 30,458
- Vote Rating
- 20
- Answers
- 9
Are you porting something to Ext Core?
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
16 Aug 2009 2:30 AM #15Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,067
- Vote Rating
- 96
- Answers
- 166
Something like:
Code:var el = Ext.select('td:contains(Henry)').item(0); while(el){ el = el.addClass('highlight').next(); }Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
16 Aug 2009 2:43 AM #16Sencha - Ext JS Dev Team
- Join Date
- Mar 2007
- Location
- Notts/Redwood City
- Posts
- 30,458
- Vote Rating
- 20
- Answers
- 9
I'm thinking about the possiblity of an override statement which adds come of these obscure capabilities. Pretty easy to add them. CompositeElement just encapsulates a set of DOM elements.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
16 Aug 2009 3:04 AM #17
-
16 Aug 2009 3:16 AM #18Sencha - Ext JS Dev Team
- Join Date
- Mar 2007
- Location
- Notts/Redwood City
- Posts
- 30,458
- Vote Rating
- 20
- Answers
- 9
Like this:
Then you would useCode:Ext.override(Ext.CompositeElementLite, { // need this until next release - pulled in from full Ext fill : function(els){ var me = this; // Keep reference to last version of self before refill me.prevObject = new me.constructor(me.elements); me.elements = []; me.add(els); return me; }, nextAll: function() { var els = this.elements, i, l = els.length, n, r = [], ri = -1; for (i = 0; i < l; i++) { for (n = els[i].nextSibling; n; n = n.nextSibling) { r[++ri] = n; } } this.fill(r); return this; }, andSelf: function() { if (this.prevObject) { this.add(this.prevObject.elements); // add takes an Array. Should it take another Composite??? } return this; } });
(As tested on the array-grid example in ExtJs examples as you can tell by the data)Code:Ext.select('td:contains(Altria)').nextAll().andSelf().addClass('x-grid3-dirty-cell');Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
16 Aug 2009 5:52 AM #19
-
16 Aug 2009 6:03 AM #20Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,067
- Vote Rating
- 96
- Answers
- 166
A filter method that accepts a function would be good. I'm playing around with some code now:
Obvoiusly both return the same results.Code:Ext.onReady(function(){ for(var i = 0; i < 10; ++i){ Ext.getBody().createChild({ tag: 'div', cls: i % 2 == 0 ? 'foo' : 'bar' }); } console.log(Ext.select('div').filter('.foo').getCount()); console.log(Ext.select('div').filter(function(el){ return el.is('.foo'); }).getCount()); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!


Reply With Quote