I’m creating a grid to allow creation of a Weekly Meals Menu for an institution that, (by law) must create and save these menus each week.
The grid has as the first column the “Meal Type” (with static values “Brkfst”, “Lunch”, “Dinner”) and these values will never change and will have a static id that will match the rowids in the grid (1-3).
The rest of the columns represent the 7 days of the week (“Sun”-“Sat”).
I want to have each day of the week column have a multi-select2 control which dynamically gets populated with “food” values based on which row (Brkfst,Lunch,Dinner) is currently selected.
I haven’t found any examples of this so tried to come up with the beginnings of a design ….
- In PHP create an array of dropdown “food” values for each of the 3 known rows (Bkfst,Lunch,Dinner)
- Save the 3 arrays as JS arrays in the PHP file
- Use the $opt[“onSelectRow”] grid option that calls a “do_onselect” JS function
- For each of the days of the week cols define a blank multi select2 dropdown
- When the onSelectRow event trips, somehow build the select2 dropdown using the previously saved arrays based on the currently selected row (assuming the current rowid can be discovered)
Option 2 –
Leave out step 3 above and somehow handle building the custom select dropdown values in the existing link_select2 function that handles the select2 objects.
Any advice, comments on if I’m way off here or suggestions for alternate approaches/examples would be highly appreciated.
This ticket remain unanswered due to an issue on our side.
Let us know if this case is still valid and need to be resolved.
Abu Ghufran - Dev Team
PHP Grid Framework
Abu … sorry for the delayed reponse.
I took a different approach by switching the columns for rows in the UI … and then when the grid is saved/printed I wrote (a lot) of custom TCPDF code to change the rows/columns to the way the client needs them. So I’m good to go with the approach I implemented.
How useful was this discussion?
Click on a star to rate it!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!