The new editor template does not work with Selectize

The new editor template does not work with Selectize

INTONEINTONE Posts: 153Questions: 58Answers: 6

I have been struggling to get selectize to work with editor recently which was not so difficult in the past. I found out that the editor template :

 new $.fn.dataTable.Editor({
    ajax:
    {
        url: 'some_editor_end_point',
         data: function ( d ) {
         
            if ( selected.any() ) {

              ...more data fields
            }
        }
    },
    table: '#tablename',
     template: '#customForm',
    fields: 
    [
           {
            label:'Country of Residence',
            name: 'Countries[].ID',
            type: 'selectize',
            className:'countryOfResidence',
            opts: {
                searchField:'label',
                valueField:'value',
                maxItems: null
            }
    ]
......
<div id="customForm">
<div data-editor-template="Countries[].ID"></div>

How I know is that I removed the template call from the editor init:

// template: '#customForm',

and I got selectize to work. Is there a work around to this? I find template very convenient and would not want to switch back at this point.

Answers

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    What is also interesting is that when I go the

    template: '#customForm',
    .....
    type: 'select',
    

    method, the select is shown in the editor. When I go the:

    template: '#customForm',
    .....
    type: 'selectize',
    

    no data is even loaded in the html select that is hidden. I even tried loading data manually through the
    js. options: [],
    property but that does not work either.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Interesting. I'm afraid I don't have an immediate answer for you here, but I'll look into it and get back to you.

    Allan

This discussion has been closed.