Using set get method for custom plugin
Using set get method for custom plugin
Hello there, great thanks for creating this tool, very useful, saving me lots of time.
I am trying to use my own plugin for DT Editor. I manage to create the plugin, display it., but not being able to use the set get methods wisely. The documentation or the example is not really helping me.
I recode the Datatables in JS Bin as the link below. As the Editor do not have CDN plugin available, it need to be included to see the case. i am trying to understand when and how to use get and set to save my selects back to HTML/ local storage. Also , trying to set all as unassigned when creating new by default.
Answers
Hi,
What is the format of the data that you want to get and set for your
myFieldType
field type? Whatever format that is, should be whatget
returns andset
will accept. So for example you might have an integer value that can be used with bit masks to get the state of the buttons - or you could use an enum, an array or anything else.Regards,
Allan
Hello, thank you very much for the quick response.
The data is store in an array of object in local storage e.i
[{"DT_RowId":"row_0","item":"test0","status":"Done","myFieldType":["Schedule profile 1", "Schedule profile 3"]},{"DT_RowId":"row_1","item":"test1","status":"To do","myFieldType":["Schedule profile 4", "Schedule profile 2", "Schedule profile 3"]},{"DT_RowId":"row_2","item":"test2","status":"To do","myFieldType":["Schedule profile 2", "Schedule profile 5"]}]
But when i change them using the control in my plugin, for e.g. assign all, do i need to rewrite it in the local storage "datatable_todo" or rewrite it to an array. If i use an array , when do i need to update the local storage?
The state of buttons are just for reference as i copied the online example.What i am trying to achieve is capturing the select option and update them so that it is visual in the editor .. In get set , I need to append and remove option in the select and depending on what the select contain, update the local storage.
Hello, got it working, thks a lot for your clarification.
I created an temp array to pick the values needed to add to the assigned list. I now understand how the get set works.