I have dynamically created, unpredictable (but always valid) kendo object .
Inside this object, there will sometimes be a rowTemplate method.
This object is then passed through a functionA that makes a few changes to the object (assigning default values etc.) before being passed into (sometimes) multiple kendogrids.
However, a problem arises when the rowTemplate method needs to reference the kendo grid element that it exists inside:
The parameters for rowTemplate only include the dataItem, which has no reference to the grid element or any of it's children and as the kendo object is created outside of where it is passed in to the kendo grid elements I have no scope to the grid element nor any ID it may have.
I've tried looking at the arguments to check to see if there are any extra parameters that I'm missing and there are none.
I have checked the value of this and it seems to evaluate to window.
Event is also not something I think that I can make use of.
https://dojo.telerik.com/ATesALoM/2
Two workarounds that I have thought of:
I could potentially attach a field when editing the object in functionA that is equal to the value of the to-be-created grid's ID and the grids can make use of this column in order to reference the kendo element.
The other workaround would be to (from functionA) programmatically loop through the object in search of any function and to bind those functions to the grid element, then simply have those functions assume that "this" will always be equal to the kendo grid element.
Both of these workarounds have drawbacks and I would rather only use them as a last resort.
Is there is something I am missing that would greatly simplify this?
If you require any clarification or examples needed please let me know and I'll provide them.