Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#3452 closed defect (wontfix)

FilteringTable sortFunction is unused

Reported by: guest Owned by: Tom Trenka
Priority: high Milestone:
Component: General Version: 0.4
Keywords: FilteringTable Cc:
Blocked By: Blocking:

Description

Hi, I'm using version 0.4.3 of dojo. The FilteringTable? has an attribute called sortusing, to declare the function to sort the rows. This functio is never called. In my case i patch the function 'createSortFunction' like this

function createSortFunction(fieldIndex, dir) {
		var meta = self.columns[fieldIndex];
		var field = meta.getField();

        

        if( meta.sortFunction != null ) {

            

            return function (rowA, rowB) {

                

    			if (dojo.html.hasAttribute(rowA, "emptyRow") ) 

				    return 1;

			

			    if (dojo.html.hasAttribute(rowB, "emptyRow")) 

				    return -1;

			

			    var a = self.store.getField(self.getDataByRow(rowA), field);

			    var b = self.store.getField(self.getDataByRow(rowB), field);

			    

                return dir * meta.sortFunction(a,b);

            }

        }

        
		return function (rowA, rowB) { ...

and it works fine.

Attachments (1)

FilteringTable.txt (4.2 KB) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by guest

Attachment: FilteringTable.txt added

comment:1 in reply to:  description Changed 12 years ago by guest

Replying to guest:

Hi, I'm using version 0.4.3 of dojo. The FilteringTable? has an attribute called sortusing, to declare the function to sort the rows. This functio is never called. In my case i patch the function 'createSortFunction' like this

function createSortFunction(fieldIndex, dir) {
		var meta = self.columns[fieldIndex];
		var field = meta.getField();

        

        if( meta.sortFunction != null ) {

            

            return function (rowA, rowB) {

                

    			if (dojo.html.hasAttribute(rowA, "emptyRow") ) 

				    return 1;

			

			    if (dojo.html.hasAttribute(rowB, "emptyRow")) 

				    return -1;

			

			    var a = self.store.getField(self.getDataByRow(rowA), field);

			    var b = self.store.getField(self.getDataByRow(rowB), field);

			    

                return dir * meta.sortFunction(a,b);

            }

        }

        
		return function (rowA, rowB) { ...

and it works fine.

Hi. I had the same problems with dojo-0.4.3. I patched the createSorter-function a bit different for own sortFunctions like dateSorter or floatSorter. The attached file is my patch for discussion.

Rolf Metternich

comment:2 Changed 12 years ago by Adam Peller

Owner: changed from anonymous to Tom Trenka

comment:3 Changed 12 years ago by Tom Trenka

Resolution: wontfix
Status: newclosed

Filtering is dead, long live the king!

comment:4 Changed 11 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.