selectbox not working in standalone mode, but ok in normal, bubble and inline mode
selectbox not working in standalone mode, but ok in normal, bubble and inline mode
He guys,
I'm running into some unexpected behaviour. I'm using a mjoin for population a one to many dropdown. I'm using selectize but also tried chosen and select2. When i do so, it works great in the edit popup, bubble and inline. But when I use the same field inline the select boxes aren't populated. Since the server side and js is the same , i'm wondering if there might be some initialisation script not being triggered by the stand alone version. the only other option i can think of it that i'm doing something wrong in the way i use the data-editor-field but if i change it the selectbox isn't loaded at all so it seems to be ok...
What i've done is the following:
php:
->join(
Mjoin::inst('projects', 'array')
->link('costs.id', 'costs_projects.costs_id')
->link('projects.id', 'costs_projects.projects_id')
->fields(
Field::inst('id')
->validator( 'Validate::required' )
->options( 'projects', 'id', array('id','product','title') ),
Field::inst('product'),
Field::inst('title')
)
)
js field declaration:
fields: [
{ "label": "projects:", "name": "projects[].id", "type": "selectize", "attr": { multiple: "true", size: "4" } },
html for the standalone page:
<dd class="canedit" data-editor-field="projects[].id">-</dd>
Any help would be very much appreciated!
thanks,
wouter
This question has an accepted answers - jump to answer
Answers
Are you able to give me a link to the page showing the issue please?
Allan
I have same problem I am following "https://editor.datatables.net/examples/standalone/collection.html" example, I am using .Net WebApi, I am successfully populated the Data in Html Markup, but the Select List does not populated with left join tables.
This is my Controller Code
and Model
and html
Please point me what I did wrong
The options only automatically populate when using Editor with DataTables since that information is included in the Ajax response for the DataTables "get" of the data.
Since you are using a standalone Editor there is no Ajax fetch initiated by DataTables, thus there is no way for Editor to hook into it and automatically extract the options. You'd need to use the
field().update()
method of theselect
field type to be able to set the options in response to the Ajax data you are fetching.Allan