Reputation: 1846
I have put a button on a dataGrid with the following code
column is;
var avaliableAction = {
header : "Action",
width : 120,
sortable : true,
align : "left",
dataIndex : 'status',
renderer : statusRenderer
};
data grid is;
var mainJobsGrid = new Ext.grid.GridPanel({
store : jobsStore,
columns : [ avaliableAction ],
viewConfig : {
forcefit : true
},
title : 'Data Mart Jobs',
height : 198,
width : 540,
frame : true
});
renderer is;
function statusRenderer(value, id, r) {
var START_ICON = '/etlscheduler/resources/images/start-icon.png';
var STOP_ICON = '/etlscheduler/resources/images/stop-icon.png';
if (value == "STOPPED") {
return "<input type='button' class='btnStart' onClick='doStart(); '>";
} else if (value == "RUNNING" || value == "WAITING") {
return "<input type='button' class='btnStop' onClick='doStop();'>";
}
};
and
function doStop() { ... }
function doStart() { ... }
The problem is that when I click the button exception occurs as "doStop is not defined"
Upvotes: 0
Views: 1137
Reputation: 1186
I faced the same problem, and it wasn't a typo! i have noticed that the implementation of the called function works only if it was outside the "Ext.onReady(function(){}".
If someone faces the same problem, i have solved it through writing the function as following:
Ext.the_function = function(){...}
instead of :
var the_function = function(){...}
This would fix the problem and it will work wherever you put it!
Upvotes: 0
Reputation: 1258
seems like you need to define the function
function doStop() { ... }
Upvotes: 1