PDA

View Full Version : Called Grid into cell of table HTML



cristian.munhoz
14 Sep 2010, 12:22 PM
Sorry for wrong english
Friends, I need your help.
I have in my HTML code following the line.



<table><tr><td id="executadas" onclick=javascript:openMonitor2('7','12','ADSL','BD');>30</td></tr></table>

<div id="hello-win" class="x-hidden"><div class="x-window-header">Title2</div></div>


I have this function in javascript, while some parameters to it.
Inside the function I call the "Ext.Window" with "Ext.grid.GridPanel" taking data from my database.
Using a button I can normally, but can not wear button will flee because of my rule and need to stay dynamic. I will show several lines of my table, each line will call the same function but passing dynamic values according to each data line. These lines will show in a quantitative manner only numbers, when the user clicks on the cell number he opens with Ext.Win Ext.grid.GridPanel, taking data from the database so analytically to the user seeing the information referred that number. Thus as is, where if I click first cell in the work it brings the data, but when I try to close it generates a javascript error "Invalid Argument"

Function Javascript:



function openMonitor2(a,b,c,d){

var win;
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy(
new Ext.data.Connection({
url:'contatojson.jsp' (http://www.sencha.com/forum/'contatojson.jsp')
})
),
sortInfo: {field:'nome', direction:'DESC'},
reader:new Ext.data.JsonReader({
totalProperty:'total',
root:'rows',
fields: [
'nome',
'email',
'endereco',
{name: 'dataNascimento', type: 'date', dateFormat: 'd/m/Y'}
]
})
});

var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "NOME", width: 170, sortable: true, dataIndex: 'nome'},
{header: "EMAIL", width: 150, sortable: true, dataIndex: 'email'},
{header: "ENDERECO", width: 150, sortable: true, dataIndex: 'endereco'},
{header: "DATA NASC.", width: 100, sortable: true, dataIndex: 'dataNascimento',
renderer: Ext.util.Format.dateRenderer('d/m/Y')}
],
stripeRows: true,
title: 'Informa&ccedil;&otilde;es em tempo real',
width:620,
height:500,
//applyTo: 'grid-json',
frame:true,
plugins: new Ext.ux.PanelResizer({
minHeight: 500
})
});

store.load({params:{v_a:a, v_b:b, v_c:c, v_d:d, limit:3}});

if(!win){
win = new Ext.Window({
applyTo:'hello-win',
layout:'fit',
width:640,
height:500,
closeAction:'hide',
plain: true,
items: grid,
buttons: [{
text: 'Close',
handler: function(){
win.hide();
}
}]
});

}
win.show(this);
}


Someone understood at all what I do, help me please, is there an easier way to do this.

Thank you very much