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
Forums Home / Wijmo / General Discussion
Posted by: nivishapanwar on 10 February 2021, 10:37 am EST
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)”>
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)”>
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