Loading ...
Sorry, an error occurred while loading the content.

Re: myDataTable.sortColumn only executes on the first render.....

Expand Messages
  • daniel
    FYI.. After almost crying, I found this: * The DataTable method getColumn() has a known issue where instead of accepting a Column s key index value, the method
    Message 1 of 2 , Aug 31, 2007
    • 0 Attachment
      FYI.. After almost crying, I found this:

      * The DataTable method getColumn() has a known issue where instead of
      accepting
      a Column's key index value, the method accepts a Column's ID value.
      Until this
      issue is fixed, implementers can use the following workaround:

      // Instead of this:
      // var oColumn = myDataTable.getColumn(0);

      // Use this:
      var oColumn =
      myDataTable.getColumn(myDataTable.getFirstTrEl().cells[0].yuiColumnId);

      Source:
      http://developer.yahoo.com/yui/build/datatable/README

      So I just had to use
      myDataTable.sortColumn(myDataTable.getColumn(myDataTable.getFirstTrEl().cells[0].yuiColumnId))

      instead of
      myDataTable.sortColumn(myDataTable.getColumn(0))



      --- In ydn-javascript@yahoogroups.com, "daniel" <dep@...> wrote:
      >
      > I don't understand why this would only occur once on the first load.
      > even putting alerts before and after the myDataTable.sortColumn line
      > shows the alerts, but whatever that line is doing does not run. It
      > only runs after i refresh the page and run the report for the first
      > time. why?
      >
      > var myColumnDefs = [
      > {key:"cdate", label:"Create Date", sortable:true,
      > className:"dateAndTime"},
      > {key:"ORDER_THREAD", label:"Debug", className:"hidden orderThread"},
      > //{key:"accountId", label:"Account", sortable:true,
      > className:"clickable"},
      > {key:"accountId", label:"Account", sortable:true},
      > {key:"bs", label:"Buy/Sell", sortable:true, formatter: doFormatBs},
      > {key:"qty", label:"Order Qty", sortable:true, formatter:"number"},
      > {key:"securityType", label:"Type", sortable:true},
      > {key:"stockSymbol", label:"Stock", sortable:true},
      > {key:"root", label:"Symbol", sortable:true},
      > {key:"series", label:"Series", sortable:true},
      > {key:"price", label:"Order Price", sortable:true,
      formatter:"currency"},
      > {key:"type", label:"Type", sortable:true},
      > {key:"filled", label:"Fill Qty", sortable:true, formatter:"number"},
      > {key:"fillPrice", label:"Fill Price", sortable:true,
      > formatter:"currency"},
      > {key:"status", label:"Status", sortable:true},
      > {key:"exchange", label:"Exchange", sortable:true},
      > {key:"isUI", label:"From UI", sortable:true}
      > ];
      >
      > var myDataSource = new YAHOO.util.DataSource(oXml);
      > myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
      > myDataSource.responseSchema = {
      > resultNode: "order",
      > fields: [
      > {key:"cdate"},
      > {key:"ORDER_THREAD"},
      > {key:"accountId"},
      > {key:"bs"},
      > {key:"qty",parser:YAHOO.util.DataSource.parseNumber},
      > {key:"securityType"},
      > {key:"stockSymbol"},
      > {key:"root"},
      > {key:"series"},
      > {key:"price",parser:YAHOO.util.DataSource.parseNumber},
      > {key:"type"},
      > {key:"filled",parser:YAHOO.util.DataSource.parseNumber},
      > {key:"fillPrice",parser:YAHOO.util.DataSource.parseNumber},
      > {key:"status"},
      > {key:"exchange"},
      > {key:"isUI"}
      > ]
      > }
      >
      > myDataTable = new YAHOO.widget.DataTable("myContainer", myColumnDefs,
      > myDataSource);
      > myDataTable.subscribe("columnSortEvent",groupRows);
      > myDataTable.sortColumn(myDataTable.getColumn(0))
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.