Inline editing for Editor for undefined number and names of columns.
Inline editing for Editor for undefined number and names of columns.
I have been struggeling for days with this and i am completly stuck.
I need to create a table where names and numbers of columns will depend on 2 parameters. Start and End date. Months columns would have inline editing.
Example for jan2019 & mar2019 we will have Name, Group, Jan19, Feb19, Mar19. If dates would be further appart, we would have more columns.
Is there a way to do something like this with Editor plugin ? I have just purchesed it and i still don't know its full capacity.
I tried designing my tables and code in a 50 different ways, but i can't figure out how to pass generated column names to the view...
Any suggestion would be appriciated.
Answers
Hi,
There are two components to this - the DataTables aspect, and the Editor aspect.
For DataTables you want to build an array for the column definitions prior to initialising the table (as DataTables doesn't have the ability to add and remove columns after initialisation). For example:
Likewise for Editor you want to do something similar, although with Editor you can use
add()
to dynamically add fields to the form:I've used simple
for
loops there - you would want to use something from your date calculations and use a differentdata
andname
properties I would imagine. But that's the basic idea.Allan
Thanks @Alan , this helps a bit but i still don't know how to build controller part for this. From what I have seen, controler needs to have exact same model as table structure in db.
So since i am building my "Months" data mostly as custom object, how can i pass it to Editor ?
For Example my tables looks like this :
And to get my model i group values by
Groupy and Country
So as a resault my model looks something like this
Is it possible to pass this custom model in to Editor ? btw i work with .net mvc