Arranging the data alphabetically in wijmo listbox

Posted by: nivishapanwar on 10 February 2021, 10:37 am EST

    • Post Options:
    • Link

    Posted 10 February 2021, 10:37 am EST

    Hello,

    How can we arrange the data in listbox alphabetically on selection of radio button. Using typescript code.

    Thank you.

    Regards,

    Nivisha Panwar

  • Posted 12 February 2021, 4:01 am EST

    Hi Nivisha,

    You may add SortDesription object to the collectionView.sortDescriptions collection to sort the data. You May refer to the following sample demonstrating the same:

    https://codesandbox.io/s/wijmo-angular-forked-yjn5r?file=/src/app/app.component.ts

    Regards

    Sharad

  • Posted 15 February 2021, 10:47 am EST

    Hi Sharad,

    I tried with the same logic, but it didnt work for me.

    name: CollectionView;

    this.name = new CollectionView(this.recordData);

    rChange(val) {

    //let cv = this.ListData.collectionView;

    if (val) {

    this.name.sortDescriptions.push(new wjCore.SortDescription(null, true));

    } else {

    this.name.sortDescriptions.clear();

    }

    }

    <wj-list-box #ListData [itemsSource]=“name”

    (selectedIndexChanged)=“displayListBoxValueInTextField(ListData)”>



    Alphabetical Logical
    Does the soln doesnt work for dynamic data? Thank you, Nivisha
  • Posted 16 February 2021, 2:05 pm EST

    Hi Nivisha,

    The solution is supposed to work with dynamic data too. Please explain about the issue you are facing and share a sample that replicates the issue so that we could further investigate it and assist you accordingly.

    Regards

    Sharad

  • Posted 19 February 2021, 10:43 am EST

    Hello Sharad,

    The issue is when I choose alphatical radio box , the data is not getting sorted.

    name: CollectionView;

    this.name = new CollectionView(this.recordData);

    rChange(val) {

    //let cv = this.ListData.collectionView;

    if (val) {

    this.name.sortDescriptions.push(new wjCore.SortDescription(null, true));

    } else {

    this.name.sortDescriptions.clear();

    }

    }

    <wj-list-box #ListData [itemsSource]=“name”

    (selectedIndexChanged)=“displayListBoxValueInTextField(ListData)”>

    Alphabetical Logical
    Thank you. Regards, Nivisha
  • Posted 23 February 2021, 4:33 am EST

    Hi Nivisha,

    Nothing in the code snippet seems out of ordinary. Please share a sample that replicates the issue so that we could further investigate it and assist you accordingly.

    Regards

    Sharad

  • Posted 24 February 2021, 2:09 am EST

    Hi Sharad,

    Thank you for the help. It’s working fine now.

    Regards,

    Nivisha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels