Skip to main content
1-Visitor
June 11, 2015
Question

Sorting grid column

  • June 11, 2015
  • 5 replies
  • 7877 views

Hi,

I have one grid which is updating dynamically.
I want particular column to be sorted automatically, like latest records should be on always top.

Please provide any solution for this.

Thanks.

    5 replies

    1-Visitor
    June 11, 2015

    Hi Praveen,


    I recommend you use the Sort function in your service to deliver the data sorted to the client side.

    (Query also supports Filter and Sort so you can do that too)



    1-Visitor
    April 6, 2017

    Hi,

    Am i being silly or not ?

    I'm doing this :

                var sort = new Object();

                sort.name = "myColumnName";

                sort.ascending = true;

                Infos.Sort(sort);

    But I keep getting that error :

    But the Infos dataTable isn't null.

    [TransformResultSetStations] :JavaException: java.lang.IllegalArgumentException: Invalid format: "org.mozilla.javascript.Undefined..."

    22-Sapphire I
    April 6, 2017

    Try this snippet

    var params = {

      sortColumn: undefined /* STRING */,

      t: undefined /* INFOTABLE */,

      ascending: undefined /* BOOLEAN */

    };

    // result: INFOTABLE

    var result = Resources["InfoTableFunctions"].Sort(params);

    praveenp1-VisitorAuthor
    1-Visitor
    June 11, 2015

    I used Sort function, but i am getting following error

     "Wrapped java.lang.Exception: Unable To Convert From java.lang.String to INFOTABLE Cause: Unable To Convert From java.lang.String to INFOTABLE"

    var params = {

        sortColumn: "timestamp" /* STRING /,<br>    t: "ClientName_Events" / INFOTABLE /,<br>    ascending: true / BOOLEAN */
    };

    // result: INFOTABLE
    var result = Resources["InfoTableFunctions"].Sort(params);
     
    Here in code :
    "timestamp" is my column name,
    "ClientName_Events" is INFOTABLE,

    Tried BaseType as Text, DateTime and InfoTable.

    Is am doing anything wrong?



    19-Tanzanite
    June 12, 2015

    Hi Praveen,

    In your code you try to pass a String as an Infotable, meaning here: t: "ClientName_Events" /* INFOTABLE */, I presume that you wanted to say actually:

    t: ClientName_Events /* INFOTABLE */, ?

    BR, Vladimir

    1-Visitor
    July 28, 2016

    Hi, is it possible to sort on many columns, one after another using Sort, like "ORDER BY" of SQL ?

    22-Sapphire I
    July 28, 2016

    Yes, you can use the Query statement to do a multi query/sort

    See this: Query Parameter for Query Services

    1-Visitor
    March 25, 2017

    Hello

    I would like to do this sorting on a particular column for a Grid generated automatically with "GetImplementingThingsWithData" .

    How could I access to the associated query to add the "sort" parameter ?

    Or should I generate the grid by another way ?

    Thanks

    Pascal

    1-Visitor
    March 25, 2017

    Hello, if you can use the service QueryImplementhingsWithData instead, the input parameter "query" can be provided with sort statement

    1-Visitor
    March 25, 2017

    Thanks for advice

    The problem is that I have a large number of widgets already associated to the service datas so it will be a large rework (I don't know if there is an easy way to replace the service in the mashup or somewhere without loosing all dependencies ? )

    I just read that in 7.4 grid will be improved perhaps it will cover my needs with less efforts  ?

    These features will be available at the end of March 2017.

    • Advanced Grid: New grid widget with improved design, context menu, multi-column sorting, global search and many more common grid-related features.



    But I'll use this service for further mashups