How to access instance of own field?
How to access instance of own field?
Hi
I was searching for answer without success, trying to read manual and guide:
https://editor.datatables.net/manual/development/field-types
but has stack.
I have own field type prepared based on above guide. Working fine, but I do not know how can I access my own instance from set(), get() etc field's functions? I have code doing some stuff preparing widget etc and in some cases I would like to fire error or put other information for user using build-in field attributes and functions.
Should I store reference to my object in global jscript scope? What is the proper way to use API functions provided by Editor on my own field instance?
Replies
Store the instance into the
conf
object that is passed into each plug-in method. Thatconf
object is unique to each field.You can see a basic example of that in this plug-in (and most of the others) where I use
conf._input = $('<div id="'+id+'"></div>');
.Allan