Sort Expressions

6 posts, 0 answers
  1. Kyle
    Kyle avatar
    27 posts
    Member since:
    Sep 2008

    Posted 09 Sep 2008 Link to this post

    I am having trouble accessing the sort expressions in the javascript model.  Using get_masterTableView().get_sortExpressions(); always seems to return an array of size zero.  This occurs even when the grid is sorted or grouped.  I need some way of accessing the sort expressions so that they may be sent to a child window.  Has anyone had any trouble or success getting the sort values in javascript?

    Thanks,
    Kyle
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 10 Sep 2008 Link to this post

    Hello Kyle,

    Generally these are special collections available for client-side data-binding. Can you post a bit more info about your scenario?

    Sincerely yours,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kyle
    Kyle avatar
    27 posts
    Member since:
    Sep 2008

    Posted 10 Sep 2008 Link to this post

    The situation is that I have opened a child window.  Selected some sorting options.  Passed those options back to hidden fields on the grid page.  Then an ajax post is done on the grid to apply sorting and grouping options by adding sort and group expressions.  The second time I open the sorting and grouping child window, I would like to send the sort and grouping information on the querystring so that the page has the current values.  Naturally, I assumed that using get_masterTableView().get_sortExpressions(); on my grid would give me an array of the applied sort expressions.  However this array is always zero in length with no sort expressions.  Is there any way I can retrieve the sort and grouping information from the grid via javascript?

    Thanks,
    Kyle
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 15 Sep 2008 Link to this post

    Hello Kyle,

    Thank you for the additional information - now I see your point more clearly.

    I conclude that you apply the sorting/grouping operations server-side through ajax request - is this information correct? If this is the case, note that the get_sortExpressions() collection is meaningful with client-side binding only (to retrieve the sort expressions applied on the client) and will be empty in other cases.

    Therefore, you may consider storing the sort expressions applied server-side in your custom javascript array (for example) and then reference them from there when you open the pop-up window again. I hope this is viable solution for your situation.

    Best regards,
    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Kyle
    Kyle avatar
    27 posts
    Member since:
    Sep 2008

    Posted 15 Sep 2008 Link to this post

    Yes, we are using an ajax call to do server-side sorting and grouping.  Which client side events allow you to access the get_sortExpressions() array?  Basically the problem is that we allow programatic and client side changes to the grouping and sorting on the grid.  So if a user were to open the sort window and select some options.  The grid would repost with the sorting options.  However, if a user would then click a column header, the sorting would be changed.  I suppose we could capture that sorting event and use ajax to update the "saved settings."  This would be much easier if we could just get the sortExpressions already formatted from the grid at some point.  Is there any way to do this on the grid?

    Thanks,
    Kyle
  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 17 Sep 2008 Link to this post

    Hello Kyle,

    Thank you for the additional explanation. Since the get_sortExpressions() collection is populated only when the grid is bound client-side, you may consider the option to save the sort expressions (applied server-side) in a javascript array as suggested previously, then pass this array from the server to the client in order to use it on subsequent sort actions when the pop-up window is opened again. Note that the concrete implementation of this approach strictly depends on your own custom logic.

    Best regards,
    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017