Gilant
10-04-2007, 06:09 PM
(forked from grid.render not working, no error (http://extjs.com/forum/showthread.php?t=14257) thread, as I finally progressed to a completely different error)
I'm trying a perhaps ambitious experiment to sell my coworkers & product managers on the potentials of Ext. Not to mention try a real project to continue learning Ext. I want to update one of the most important tools on our website to use grid for displaying reports (eventually complete with paging, filtering etc). Changing the site to use Ext for everything, including form generation, would be beyond the scope of this experiment. However for the purposes of this discussion I have tried to isolate the active pieces used in this test, the piece of xhtml to display the button looks like this in the servers response:
<button class="run_report_button">Grid Report</button>
The javascript used to activate this button to submit the form via Ext.Ajax and parse the JSON response to configure the grid dynamically are currently:
var set_run_report_button = function() {
var submit_report = function() {
alert('Sending ajax request');
new Ext.Ajax.request({
form: 'performance_report_form',
text: 'Generating report...',
success: function(result, request) {
alert('starting to build grid with: ' + result);
var jsonData = Ext.util.JSON.decode(result.responseText);
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', 'Successfully posted form: '+ result.date);
}
});
} // submit_report
var buttons = Ext.select('button.run_report_button', true)
Ext.each(buttons, function(element) {
element.on('click', submit_report);
})
}
Ext.onReady(set_run_report_button);
This fires on a button click as desired, and the 'Sending ajax request' alert is displayed. However after clicking OK I get the following error:
this.fireEvent is not a function
if(this.fireEvent("beforerequest", this, o) !== false){
I've tried a number of variations on the above code (in-lining the submit_report function, buttons.each etc), and all the ones that work to the point of the alert generate the same error. I do use Prototype.js for a large number of other form controls on the same page, but the only event configured on the button is by Ext.
I'd love to see our data load up into a grid. Help would be greatly appreciated!
I'm trying a perhaps ambitious experiment to sell my coworkers & product managers on the potentials of Ext. Not to mention try a real project to continue learning Ext. I want to update one of the most important tools on our website to use grid for displaying reports (eventually complete with paging, filtering etc). Changing the site to use Ext for everything, including form generation, would be beyond the scope of this experiment. However for the purposes of this discussion I have tried to isolate the active pieces used in this test, the piece of xhtml to display the button looks like this in the servers response:
<button class="run_report_button">Grid Report</button>
The javascript used to activate this button to submit the form via Ext.Ajax and parse the JSON response to configure the grid dynamically are currently:
var set_run_report_button = function() {
var submit_report = function() {
alert('Sending ajax request');
new Ext.Ajax.request({
form: 'performance_report_form',
text: 'Generating report...',
success: function(result, request) {
alert('starting to build grid with: ' + result);
var jsonData = Ext.util.JSON.decode(result.responseText);
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', 'Successfully posted form: '+ result.date);
}
});
} // submit_report
var buttons = Ext.select('button.run_report_button', true)
Ext.each(buttons, function(element) {
element.on('click', submit_report);
})
}
Ext.onReady(set_run_report_button);
This fires on a button click as desired, and the 'Sending ajax request' alert is displayed. However after clicking OK I get the following error:
this.fireEvent is not a function
if(this.fireEvent("beforerequest", this, o) !== false){
I've tried a number of variations on the above code (in-lining the submit_report function, buttons.each etc), and all the ones that work to the point of the alert generate the same error. I do use Prototype.js for a large number of other form controls on the same page, but the only event configured on the button is by Ext.
I'd love to see our data load up into a grid. Help would be greatly appreciated!