Closed suchithmahadi closed 6 years ago
If you want a function attached inside the string you have to pass a string
drawGauge: `function(id){
alert(1);
}`
Sorry @artf i didn't understood what exactly you are saying, can you please elaborate? Here i want to call the function ("drawGauge" which is in 3rd line) in domComponents script function. Please explain related to the problem given above. Thanks for your help. please help in this as it is very critical for me and i am stuck on this from past 1 week.
Inside your script
property, {[ d ]}
will be replaced with a d
property of the componet and it can't be a function, so if your final result should be like this:
var di = function() {...};
you have to set a string for d
...
removable: true,
d: "function() {...}",// <- string, NOT function
draggable: true,
editable: true,
...
One question so as per your explanation var di will be a string. But to achieve my goal i need to call drawGauge function in domComponents Script function. How to achieve this now ? Would be more help if you solve this.
ok, d
just can't be a function, it should contain your final string. It's up to you understand how/when to update it, eg. on init/trait change
..In your model
init() {
this.set('d', options.drawGauge()); // initial value
// then you could add a listener for your traits and change its value later
this.listenTo(this, 'change:circles', this.doStuff)
},
doStuff() {
this.set('d', options.drawGauge());
}
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I am calling a function which is outside the component same as explained in issue #395 but it is returning a string instead of a function I want to call defaults.drawGauge function in script and pass the id that is created dynamically
I am stuck please help me out grapesjs.plugins.add('liquid-gauge-plugin', function(editor, options){
})