Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Sorting not working on few columns in ListGrid

    Hello,
    I have a list grid. It has many columns. Some of the columns are of type "float" and they are mapped to Double type attribute in java bean mapped to the grid row.

    Now issue is that for few columns the null/empty column are not taken into account when i click on column header to sort. But sorting is working on some other columns with same type .
    So what happens is that null/empty are not grouped at bottom or top in those problematic columns. But yes the sorting happens in group in between those null values.
    For eg 11 rows have following values for a column

    10
    <empty>
    <empty>
    12
    13
    9
    <empty>
    4
    34
    7
    <empty>

    When column sorting is clicked following is the result.

    10
    <empty>
    <empty>
    9
    12
    13

    <empty>
    4
    7
    34
    <empty>

    So basically groups in between empty cells sort among themselves.
    Same is working fine on other columns.

    I am giving field definition of working and problematic columns here.
    Sorting fine column
    Code:
     
    {name: "bidYield", title: "Bid Yld", type: "float", width: 60, prompt: "Bid Yield", 
    					formatCellValue: "isc.Format.toUSString(value, record.yieldDisplayPrecision)", 
    					//formatEditorValue: "isc.Format.toUSString(value,  record.yieldDisplayPrecision)",
    					canEdit: true, change: function() {this.grid.bidChanged();}, doubleClick: function (form, item){item.selectOnFocus = true; item.focusInItem();}},
    Problematic column doesn't sort/groups null values in bottom or top

    Code:
    {name: "mostRecentPrice", title: "Most Recent", type: "float", formatCellValue: "isc.Format.toUSString(value,  record.priceDisplayPrecision)", width: 75, prompt: "Most recent market data item", canEdit: false, canHide: false,showHover:true,hoverHTML: function (record){return record.mostRecentmDataItemDesc;}},
    {name: "latestPrice", title: "Latest", type: "float", formatCellValue: "isc.Format.toUSString(value,  record.priceDisplayPrecision)", width: 60, prompt: "Most latest market data item", canEdit: false,showHover:true,hoverHTML: function (record){return record.mostLatestDesc;}},
    I compared the list also returned in result and it clearly contains java "Null" for empty values for both kind of columns.

    DS entries for these are
    Code:
    <field name="bidYield" type="float" hidden="true"/>
    <field name="mostRecentPrice" type="float"/>
    <field name="latestPrice" type="float"/>

    Any idea what can be wrong.?

    thanks

    #2
    Something's wrong with the data values for those records. Look at them using the Developer Console. If it's not clear what's wrong, please put together code that we can run to see the problem.

    Comment


      #3
      I have figured out the problem. That was our code faults. Some one had overridden formatCellCSSText method and on these columns the value was being modified/formatted manually (rather than using isc.Format.toUSString) . Which was making the value as String so comparison was getting wrong and sorting was not working.
      Else there is not problem in ListGrid sorting and now after changing that code sorting on clicking of header works like charm.

      Regret unnecessary confusion.

      -

      Comment


        #4
        Had the same problem with XSD Datasource

        Hallo, just a note from my side.
        I had exactly the same problem with the sorting of numbers.
        I use a XSD datasource. In case of the XML tag containes no value (e.g. <AMOUNT/>), the datasource writes an empty string into the appropriate record field.
        I solved this, by overriding transformResponse of the XML datasource and put a null value in an empty number field,
        e.g.: record.setAttribute("AMOUNT", (Double) null)
        Then the sorting worked.

        Comment

        Working...
        X