I have this component in ExtJS to which I am setting some HTML and there is an onclick inside it that I have to call. So How do I call a javascript function from HTML of an Extjs component
This is my code:
for the component:
collapsed: true,
layout: 'fit',
items: [
{
xtype: 'component',
itemId: 'requirementHeaderViewID-' + i,
html: arrReqTplTest
}
}
);
This is the HTML:
arrReqTplTest = ['<div class="wrap-req"><table><tr><th class="wrap-req">' +
'NAME ' +
'<img src="resources/images/arrow-bottom-1-512.png" width="10px" height="10px" onclick="{[this.sortStore();]}"/>' +
'</th><th class="wrap-req">CATEGORY ' +
' <img src="resources/images/arrow-bottom-1-512.png" width="10px" height="10px" onclick="sortStore();"/>' +</th>'</table>',
</th></tr></table></div>
This is the function lets say:
sortStore: function(){
alert('xyz');
}
I have shortened the code for your ease, so might have syntax errors but rest assured everything fine but I just need to know how to call a JS function from HTML that is part of Ext.JS component after the page is loaded.