jQuery UI Widgets Forums DataTable DataTable not respecting array order

This topic contains 1 reply, has 2 voices, and was last updated by  Todor 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • gawyndragonspawn
    Participant

    Greetings,

    I’m attempting to use the Datatable to create something similar to rows rendering example.

    I’m successfully loading my data from my API as JSON, but this is where I run into an issue. All of my sorting, filtering, etc is done server side, and returns the JSON object in the order I desire it to output. This works perfectly, as long as I don’t group the items in the Datatable.
    An example:
    I have multiple product categories, eg. Cat1, Cat2, Cat3. Each of these categories has 1 or more sub categories, eg. Cat1Sub1, Cat1Sub2, etc. When I initialize the table, I use groups: [“BrandTitle”, “BrandName”] to combine the appropriate groups/subgroups. The JSON object would like this:

    {
    Available: “Available”
    BrandName: “Cat1SubCat1”
    BrandTitle: “Cat1”
    Description: “Some thing”
    DescriptionFull: “Some new thing from us!”
    ItemNumber: “1234”
    MarketingComments: null
    Size: “each”
    }
    {
    Available: “Available”
    BrandName: “Cat1SubCat2”
    BrandTitle: “Cat1”
    Description: “Some thing”
    DescriptionFull: “Some new thing from us!”
    ItemNumber: “4321”
    MarketingComments: null
    Size: “each”
    }

    {
    Available: “Available”
    BrandName: “ACatSubCat1”
    BrandTitle: “ACat”
    Description: “Some thing”
    DescriptionFull: “Some new thing from us!”
    ItemNumber: “5678”
    MarketingComments: null
    Size: “each”
    }

    If groups are not set, Cat1 and its subcategories will appear first, like I want them to. If groups are set as I mentioned, ACat will appear first. How can I disable this automatic sorting when grouping?

    Regards,
    Dan

    DataTable not respecting array order #104768

    Todor
    Participant

    Hello gawyndragonspawn,

    Unfortunately you cannot disable it. The data should be sorted in order for groups to work.

    Let us know if you need further assistance.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.