How to load Editor definitions/configurations from server side?

How to load Editor definitions/configurations from server side?

fittafitta Posts: 7Questions: 3Answers: 0

Hello, I'm new to using DataTables and Editor. Currently I have declared an editor instance like the following:

editor = new $.fn.dataTable.Editor({
// some other attributes...
fields: [
            { 
              label: 'blah',  
              name: 'blah', 
              type: "select",
              options: [
                  { label: 'data1', value: 'data1' },
                  { label: 'data2', value: 'data3' },
                  { label: 'data3', value: 'data3' },
                  // many more options here...
              ]
            }
        ]
});

where the "options" array inside "fields" definition have many rows/options. My goal is to load these options from server side instead of hard-coding them in JS. Is there a way that this can be achieved? If yes, could anyone point me to some examples? So far I've tried to first make an ajax call to server on document load, then store the data from server to a JS variable, and then pass that variable to the "options" attribute above, but that doesn't seem to work.

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.