richselect - options sort

Hi,

I use richselect in datatable and need to sort options by value.
https://snippet.webix.com/mq1xn2z5

Thank

Comments

  • edited April 29

    Hello @nkm ,
    As a solution, you can try to specify the initial sorting rule use the extended configuration:

        options: {
          body: {
        //view:"list" is not necessary
            scheme: {
              $sort: {
                by: "value",
                dir: "asc",
                as: "string"
              }
            },
            data: [
              { id:1, value:"Banana" }, 
              { id:2, value:"Papaya" }, 
              { id:3, value:"Apple" }
            ]
          }
        }
    

    Please check the next snippet:
    https://snippet.webix.com/glwzjfuz

    Or you can dynamically sort the component using the sort() method:

    $$("richselect1").getList().sort("#value#","desc");
    

    Example:
    https://snippet.webix.com/llu26uei

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!