Dynamic number of columns for virtual list

Hi,

I have a Virtual List of items with 3 columns set in VL settings. I want to add a drop down where user can choose number of columns so that 4 in a row and 5 in a row and so on items can be shown in grid. How to achieve that since col are specified in VL settings?

Can grid size of columns etc be changed dynamically?

Thanks for help.

var vl = app.virtualList.get('.virtual-list');
vl.params.cols=5;
vl.update();
1 Like

Update parameters and call update method:

var vl = app.virtualList.create(...);

// later
vl.params.cols = 4;
vl.update();

And make sure to update class or something to reflect it in CSS too

Brilliant, thanks for your help