Search code examples
yadcf

Passing from server select values and labels


Is it possible to pass from server select values and labels.

It would be nice to be able pass to pass id's and string representations to select2.

For example, I want to pass [[1, 2, 3, 4, 5], ["name1", "name2" ..., "name5"].


Solution

  • Just like in the client side setup of yadcf you can send from server an array of objects with value / label

    See in Server side source example inspect the dev tools -> Network - > entrys_table_server_side_source, look at the yadcf_data_0

    yadcf_data_0: [{value: "Trident", label: "Trident Eng'"}, 
                   {value: "Tasman", label: "Tasman Eng'"},…]