Sorting Checkboxes from Collection

Hi folks,
I am using the following code to add checkboxes from data in a collection and sort the the CategoryName field. It does load the text from the collection into the checkboxes, but I can’t get it to sort the CategoryName. Could someone please tell me what is wrong?

import wixData from 'wix-data';

$w.onReady(function () {

    $w.onReady(() => {
        wixData.query('linkCategories2')
            .ascending('CategoryName')
            .find()
            .then(res => {
 let options = [{ "value": '', 'label': 'CategoryName' }];
                options.push(...res.items.map(category => {
 return { 'value': category.categoryName, 'label': category.categoryName };
                }));
                $w('#checkboxGroup1').options = options;
            })

    });

});
1 Like

SOLVED: TOO EASY!
Typo! I needed “” instead of ‘’.

import wixData from 'wix-data';

$w.onReady(function () {
    $w.onReady(() => {
        wixData.query('linkCategories2')
            .ascending("categoryName")
            .find()
            .then(res => {
 let options = [];
                options.push(...res.items.map(category => {
 return { 'value': category.categoryName, 'label': category.categoryName };

                }));
                $w('#checkboxGroup1').options = options;

            })

    });

});