Dear Abu,
I have query regarding multiple select drop down in add/edit pop up. Actually i have one master grid showing all the news articles, in case of add new article i add article data like(article title,description,date,brand dropdown etc.) earlier i was adding single brand for one article but now i have to add multiple brands for single article. Can u please suggest me how it is feasible? Now in add/edit pop up i will have to select multiple brands from dropdown.
Note: Please take care of edit record popup for that multiple selected drop down(brand_id)
Table Structure is below:-
—————————
Table name = news_article_brands
Columns = id, brand_id, article_id
Hello,
For multi-selection of dropdown, you can have select2 with multiple option. Refer demos/integration/dropdown-select2.php
// to enable multiselect option
$col["editoptions"]["multiple"] = "multiple";
It will result in following:
http://easycaptures.com/fs/uploaded/801/5587551854.png
Now it will post comma separated values to server.
On backend, you need to use on_update event handler and write your manual code to insert into your one-many relation table.
Refer demos/editing/custom-events.php
Hi,
In case of "add record" its working fine but in "edit" its not working fine. Also not showing last selected records in edit mode.
Can u please help in that case.
Table Structure is below:-
—————————
Table name = news_article_brands
Columns = id, brand_id, article_id
Database entries are like below
[id] [brand_id] [article_id]
1 10 100
2 11 100
3 12 100
Also have one question which of below structure is good to store multiple data(add/edit/delete) in database for select2 dropdown
Structure-1:-
————–
Database entries are like below
[id] [brand_id] [article_id]
1 10,11,12 100
Structure-2:-
————–
Database entries are like below
[id] [brand_id] [article_id]
1 10 100
2 11 100
3 12 100
For edit, you need to select brand_id using group_concat function.
This will return brand_id comma separated and it will be loaded in multi select by phpgrid.
On main grid the comma separated values are coming now. But in edit popup case the previous selected values not showing. please help