Sort with Conditional sort direction in JS- help!

  1. #1

    Sort with Conditional sort direction in JS- help!

    I need to conditionally set the sort direction of the below, but keep getting a syntax error:

    #{storeContracts}.sort(#{cbSortBy}.getValue(),'DESC');
    Needs to be something like:

    #{storeContracts}.sort(#{cbSortBy}.getValue(),if (#{cbSortBy}.getValue() == 'totalCharge'){ 'ASC'}else{ 'DESC'});
  2. #2

    RE: Sort with Conditional sort direction in JS- help!

    Hi,

    try this
    #{storeContracts}.sort(#{cbSortBy}.getValue(), (#{cbSortBy}.getValue() == 'totalCharge') ? *'ASC' : 'DESC');
    *
  3. #3

    RE: Sort with Conditional sort direction in JS- help!

    Worked great thanks!

Similar Threads

  1. [CLOSED] combo sort
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: Jan 12, 2012, 7:29 PM
  2. Replies: 4
    Last Post: Jul 25, 2011, 4:57 PM
  3. GroupingView and sort
    By threewonders in forum 1.x Help
    Replies: 2
    Last Post: Apr 27, 2011, 8:46 AM
  4. Sort and Paging in MVC
    By Dominik in forum 1.x Help
    Replies: 0
    Last Post: Jun 30, 2010, 9:44 AM
  5. MultiSelect Sort AfterDrop
    By BillyZ313 in forum 1.x Help
    Replies: 9
    Last Post: Apr 15, 2010, 6:45 PM

Posting Permissions