refer to html-button in ExtJS file
In a jsp file, a form is created wherein a button is specified.
I am using ExtJS 4. I need to get reference of the html-button in ExtJS file. On click of this html-button, display the Ext components(grid panel) on the page. I tried using Ext.DomQuery but no luck. Please provide pointers
Also posted at ExtJS4 forums http://www.sencha.com/forum/showthread.php?148205-refer-to-html-button-in-ExtJS-script&p=652122
Thanks, -Divya
code snippet below:
report.jsp
<%@ page import="java.util.*" %>
<%@ page import="java.io.PrintWriter" %>
<%
some java code
%>
<link rel="stylesheet" type="text/css"
href="../js/extjs4/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../js/extjs4/shared/example.css" />
<script type="text/javascript" src="../js/extjs4/bootstrap.js"></scr开发者_如何学运维ipt>
<script type="text/javascript" src="../js/extjs4_scripts/report/reportPanel.js">
</script>
<form name="reportpage" id="prcr" method="post" action="url">
<table>
<tr>
<td>
<input id=\"osSubmitButton\" type=\"button\" name=\"submitRelease\" value=\"Submit\">
</td>
</tr>
</table>
</form>
reportPanel.js
Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../extjs4/ux/');
Ext.require([
'Ext.DomQuery.*',
'Ext.data.*',
'Ext.grid.*',
'Ext.tree.*',
'Ext.util.*',
'Ext.toolbar.Paging',
'Ext.ux.grid.FiltersFeature',
'Ext.tip.QuickTipManager'
]);
Ext.onReady(function() {
Ext.tip.QuickTipManager.init();
var btn=Ext.query("#osSubmitButton");
btn.on("click", function(){
console.info("clicked");
relstore.load();
reportPanel.setVisible(true);
});
});
Since you know the id of the button you can just call Ext.get.
Ext.get('osSubmitButton').on('click', ...);
精彩评论