Preciso, de uma ajuda.
Coloquei um botão na grid, só que não estou sabendo como colocar uma função, para pegar o evento ao clicar no botão.
{
header: 'action',
width: 85,
sortable: false,
renderer: function(val){ return '<input type="button" value="Detalhes" id="00"/>'; },
dataIndex: 'detalhesBotaoLink'
}
Tem alguma outra forma de colocar botão na grid? Pois tentei outras e não deu certo.
Fico no aguardo.
At
<?php
session_start();
include("../../../../resources/config.php");
include("../../../../autoload.php");
print "tab_processo_admissao_".$_REQUEST['mf'].".findById('id_processo_admissao_estrutura_".$_REQUEST['mf']."').setValue(1);";
?>
//MONTA A GRID COM OS DADOS MONTADOS ACIMA
Ext.grid.CheckColumn = function(config){
Ext.apply(this, config);
if(!this.id){
this.id = Ext.id();
}
this.renderer = this.renderer.createDelegate(this);
};
Ext.grid.CheckColumn.prototype ={
init : function(grid){
this.grid = grid;
this.grid.on('render', function(){
var view = this.grid.getView();
view.mainBody.on('mousedown', this.onMouseDown, this);
}, this);
},
onMouseDown : function(e, t){
if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
e.stopEvent();
var index = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(index);
record.set(this.dataIndex, !record.data[this.dataIndex]);
}
},
renderer : function(v, p, record){
p.css += ' x-grid3-check-col-td';
return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
}
};
checkOk = new Ext.grid.CheckColumn({
header: 'Alterar Status',
width: 50,
dataIndex: 'statusBotao'
});
st_processo_admissao_estrutura_<?php echo $_REQUEST['mf'];?> = new Ext.data.Store({
url: 'source/controller/pqec/estrutura/dados.php?id_entidade=<?php print $_REQUEST['id_entidade'];?>',
reader: new Ext.data.JsonReader(
{root: 'results', totalProperty: 'total', id: 'id'},
[
{ name: 'id_entidade', mapping: 'id_entidade', type: 'int'},
{ name: 'item', mapping: 'item', type: 'string'},
{ name: 'status', mapping: 'status', type: 'string'},
{ name: 'visualizarBotao', mapping: 'visualizarBotao', type: 'string'},
{ name: 'esclarecimentoBotao', mapping: 'esclarecimentoBotao', type: 'string'},
{ name: 'detalhesBotao', mapping: 'detalhesBotao', type: 'string'}
]),
pruneModifiedRecords: true
});
grid_processo_admissao_estrutura_<?php echo $_REQUEST['mf'];?> = new Ext.grid.GridPanel({
ds: st_processo_admissao_estrutura_<?php echo $_REQUEST['mf'];?>,
cm: new Ext.grid.ColumnModel([
{ header: 'id_entidade', sortable: true, dataIndex: 'id_entidade', hidden:true},
{ header: 'Item', width: 70, sortable: true, dataIndex: 'item'},
{ header: 'Status', width: 50, sortable: true, dataIndex: 'status'},
{ header: 'Visualizar', width: 70, sortable: true, dataIndex: 'visualizarBotao'},
{ header: 'Esclarecimento', width: 50, sortable: true, dataIndex: 'esclarecimentoBotao'},
{ header: 'Detalhes', width: 50, sortable: true, dataIndex: 'detalhesBotao'},
{
header: 'action',
width: 85,
sortable: false,
renderer: function(val){ return '<input type="button" value="Detalhes" id="00"/>'; },
dataIndex: 'detalhesBotaoLink'
}
]),
enableColLock:false,
border: false,
height: 215,
loadMask: true,
viewConfig: {forceFit: true}
});
function actionxxx(){
alert('vvvvvvvvvv');
}
//grid_processo_admissao_estrutura_<?php print $_REQUEST['mf']?>.on('celldblclick',update_grid_processo_admissao_estrutura_<?php print $_REQUEST['mf']?>);
st_processo_admissao_estrutura_<?php echo $_REQUEST['mf'];?>.load();
tab_processo_admissao_<?php echo $_REQUEST['mf'];?>.findById('processo_admissao_estrutura_<?php echo $_REQUEST['mf']?>').items.add(grid_processo_admissao_estrutura_<?php echo $_REQUEST['mf'];?>);
st_processo_admissao_estrutura_<?php echo $_REQUEST['mf'];?>.on('load',function(){content_<?php echo $_REQUEST['mf'];?>.doLayout();});