[Dojo-interest] FilteringTable sort

ibsscott sallan1000 at aol.com
Tue Feb 27 12:39:30 MST 2007


It looks a bit complicated for me to take this on myself. Is that something
you think you could handle? Also, you would need to add the fixes to the
store AND filteringtable for events addDataRange, updateData, and
updateDataRange for me to be able to use your code.  These are critical to
what I need to use the table for.  Here's the code I have for
filteringTable, I don't believe the HEAD version of filteringTable is
corrected completely yet as there is an outstanding ticket, but the store
should be ok.

		dojo.event.connect(this.store, "onUpdateData", function(updatedObject){
			var oldRow = self.getRow(self.store.getDataByKey(updatedObject.key));
			var newRow = self.createRow(updatedObject);
			self.domNode.tBodies[0].replaceChild(newRow, oldRow);
			self.render();
		});
		dojo.event.connect(this.store, "onAddDataRange", function(arr){
			for(var i=0; i<arr.length; i++){
				arr[i].isSelected=false;
				var row=self.createRow(arr[i]);
				self.domNode.tBodies[0].appendChild(row);
			};
			self.render();
		});
		dojo.event.connect(this.store, "onUpdateDataRange", function(arr){
			for(var i=0; i<arr.length; i++){
				var old=self.getRow(self.store.getDataByKey(arr[i].key));
				var row=self.createRow(arr[i]);
				self.domNode.tBodies[0].replaceChild(row, old);
			};
			self.render();
		});


Sasha Firsov wrote:
> 
>  
> 
> 
> The patch is for custom rendering, but you can use the same logic for
> sorting: 
> -&nbsp;&nbsp;&nbsp; fillCell: function(/* HTMLTableCell */cell, /* object
> */meta, /*
> object */val){ 
> +&nbsp;&nbsp;&nbsp; fillCell: function(/* HTMLTableCell */cell, /* object
> */meta, /*
> object */val, /* object */obj){ 
> 
> Since the features you want to see are related to my patch, we could
> create common patch. 
> The common is use pattern: treat data row rather the field as entity
> for sort, filter and sort. 
> Sasha 
> 
> working sample (slow): 
> http://firsov.net/~suns/demos/dojo/FilteringTable_fillCell/dojo-base/tests/widget/test_FilteringTable_fillCell.html 
> patch: 
> 
>   FilteringTable.js 
>   
>   FilteringTable.js.diff 
>   
>   test_FilteringTable_fillCell.html 
>   
> 
> 
> inline... 
> ibsscott wrote:
> 
>   I guess it needs to sort everytime since addDataRange would put the data
> in
> the wrong place.  I need an attribute called sortField and/or a
> sortByField
> event that I could initially sort on and reset the sort to that field
> later
> if needed.
>   
> 
> 
>   
> 
> ibsscott wrote:
>   
>   
>     I'm interested in seeing what you've done. I might need to write my
> own
> extension since I need to keep the new update and addDataRange fixes Tom
> put in the Head.   
> 
> I think I'd like to see render() only sort when the onSort event occurs. 
> That would probably fix it for me.
> 
> 
> 
> Sasha Firsov wrote:
>     
>     
>       If you take my patch as base, you will be able to use any field(s)
> for
> sorting.
> Sasha
> 
> ibsscott wrote:
>       
>       
>         I was under the impression that the initial sort was based on the
> Id.
> Would
> this be difficult to implement?  How else do I sort by multiple columns,
> such as row 1 then row2, then row3?
> 
> 
> Tom Trenka wrote:
>   
>         
>         
>           Sorting is never done on a hidden field, it is only on visible
> fields;
> another words the default sort is never on the "value" field of a row.
> 
> trt
> 
> 
> ibsscott wrote:
>     
>           
>           
>             Firefox on Mac and WIndows is not sorting the data in the
> table
> according
> to the "Id".  However, it is correctly getting sorted with Safari and
> IE. 
> My "Id" is a long string made of different fields such as
> date+time+sequenceNumber that keeps the data unique and I also want it
> sorted by this string. I do not display the "Id" in my table, but I do
> display most of the fields in the key.  The time column is displayed
> out
> of order.  If I do display the "Id" in the table columns, the data is
> sorted correctly. 
> 
>       
>             
>           
>               
>           
>         
>           
>         
>       
>       _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ 
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook 
> Dojo-interest at dojotoolkit.org 
> http://dojotoolkit.org/mailman/listinfo/dojo-interest 
> 
> 
>       
>     
>     
>     
>   
>   
>   
> 
> 
> 
> 
> 
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> 
> 

-- 
View this message in context: http://www.nabble.com/FilteringTable-sort-tf3298120.html#a9190069
Sent from the Dojo mailing list archive at Nabble.com.



More information about the Dojo-interest mailing list