Re: Is it possible to create the following matrix with scheduler or grid?
Posted: Fri Jul 26, 2019 10:50 am
by KAB
Hi mats. Thanks for your reply. I have not found an an example of a grid with dynamic columns. Is that possible?
Because I have a start and end date and I want to create a column for every day between those dates. The dates can also be changed and the widget should refresh itself and update it's columns.
Re: Is it possible to create the following matrix with scheduler or grid?
Posted: Fri Jul 26, 2019 11:47 am
by pmiklashevich
grid.columns is a store. So adding new records or changing existing data will reflect to the grid immediately.
So in your case it's left to implement column generation based on the time range. We don't have ready-to-use solution., so you'll have to implement it by yourself. Please check out the demos I've mentioned above and all the other demos we have for inspiration.
If you get stuck with something feel free to ask on the forums (one thread per question, see how to ask for help here). If you need complex help in implementation, we provide Professional Services. If you're interested please contact us here: https://www.bryntum.com/contact/
Best,
Pavel
Re: Is it possible to create the following matrix with scheduler or grid?
Posted: Fri Jul 26, 2019 12:21 pm
by pmiklashevich
Just to help you to get started here is how you can generate your columns:
const generateDateColumns = (start, end) => {
let columns = [],
dt = DateHelper.clone(start);
if (dt.getTime() >= end.getTime()) return columns;
while (dt.getTime() < end.getTime()) {
columns.push({
field : DateHelper.format(dt, 'YYYY-MM-DD'), // need to match data field
text : DateHelper.format(dt, 'dd DD'),
flex : 1,
region : 'normal'
});
dt = DateHelper.add(dt, increment, unit);
}
return columns;
};
Please replace examples/manycolumns/app.js with the one from archive and try how it works: