[ 3 posts ]

Zekas

  • Username: bouncingmatthew
  • Joined: Thu Oct 29, 2009 1:24 pm
  • Posts: 8
  • Offline
  • Profile
Tags:

sortOptions field with dynamicData: true

Post Posted: Tue Dec 07, 2010 1:48 pm
+0-
thanks in advanced for helping. hopefully i'm just missing something here or using the wrong function.

i have a data table with dynamic data delivered from the server. I want to make one particular column pass in a different "sort" value when the user clicks on the column header. Below is example of responseSchema with three fields and then I have the column defs below. The only difference here is that when the user clicks the "field" column, I want the data table to pass a string into the sort parameter so I can sort it differently on the server. I suppose I could build the URL dynamically but i'd rather just use sortOptions: {field: "field,field3"}. So far this is not working. Do I need to build it dynamically?

Code:
myDataSource.responseSchema = {
   resultsList: "records",
   fields: [{key:"Id",parser:"number"},"field","field2"],
   metaFields:{
      totalRecords:"totalRecords"
   }
};

var myColumnDefs = [
{"key":"Id","label":"D","sortable":true},
{"key":"field","label":"Changed By","sortable":true,formatter:this.formatOwnerUrl, sortOptions: { field: "field,field3" }},
{"key":"field2","label":"Change Date","sortable":true, sortOptions: { defaultDir: YAHOO.widget.DataTable.CLASS_DESC }}
];

Zekas

  • Username: bouncingmatthew
  • Joined: Thu Oct 29, 2009 1:24 pm
  • Posts: 8
  • Offline
  • Profile

Re: sortOptions field with dynamicData: true

Post Posted: Wed Dec 08, 2010 10:55 am
+0-
Nevermind on this post. I ended up correcting it server side but it would be a nice feature for the future. :geek:

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: sortOptions field with dynamicData: true

Post Posted: Wed Dec 08, 2010 12:20 pm
+0-
Have you tried building a custom sort function for the DataTable? Check out the reference at http://developer.yahoo.com/yui/datatable/#advancedsort for starters.

Are you trying to first sort by one column, and then by another, based upon user column heading clicks?
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum