tatoosh
30 Sep 2009, 2:23 AM
I want to use a double click in a grid view.
Whis this doubleclick a new PHP site should be open.
my code works fine with single click and without opening the page.
Doubleclick also works, but the result isn't my ID from a JSON which i loaded - it gives me the row number instead ;)
Can u help me - i started learning extjs with the help of "Learning ext JS" - great book.
Ext.onReady(function(){
// create the data store
var store = new Ext.data.JsonStore({
url: 'a_Json.php',
fields: [
{name: 'AufgabenNr', type: 'int'},
{name: 'Betreff', type: 'string'},
{name: 'Aktion_Soll_name', type: 'string'},
{name: 'AktionSollText', type: 'string'},
{name: 'Prioritaet', type: 'string'},
{name: 'Status', type: 'string'},
{name: 'Soll_Start', type: 'string'},
{name: 'Soll_Faelligkeit', type: 'string'},
{name: 'TimeStamp', type: 'string'},
{name: 'Datum_Erstellung', type: 'string'}
]
});
// load data from the url ( php file )
store.load();
// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'AufgabenNr', header: "ID", width: 25, sortable: true, dataIndex: 'AufgabenNr'},
{header: 'SollStart', width: 75, sortable: true, dataIndex: 'Soll_Start'},
{header: 'Aktion', width: 90, sortable: true, dataIndex: 'Aktion_Soll_name'},
{header: 'Betreff', width: 200, sortable: true, dataIndex: 'Betreff'},
{header: 'Soll Aktion', width: 130, sortable: true, dataIndex: 'AktionSollText'},
{header: 'Prio', width: 30, sortable: true, dataIndex: 'Prioritaet'},
{header: 'Status', width: 100, sortable: true, dataIndex: 'Status'},
{header: 'Ende', width: 75, sortable: true, dataIndex: 'Soll_Faelligkeit'},
{header: 'Erstellt', width: 75, sortable: true, dataIndex: 'Datum_Erstellung'},
{header: 'letzte Aenderung', width: 120, sortable: true, dataIndex: 'TimeStamp'}
],
stripeRows: true,
height:500,
width:950,
title:'Aufgaben Liste',
// click Event Listener
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: {
fn: function(sm,index,record) {
Ext.Msg.alert('You Selected', 'Your ID: ' +record.data.AufgabenNr);
}
}
}
})
});
// render grid
grid.render('a-grid');
/*
grid.on('rowdblclick', function(grid, rowIndex) {
Ext.Msg.alert('You Selected', rowIndex);
});
*/
});
Whis this doubleclick a new PHP site should be open.
my code works fine with single click and without opening the page.
Doubleclick also works, but the result isn't my ID from a JSON which i loaded - it gives me the row number instead ;)
Can u help me - i started learning extjs with the help of "Learning ext JS" - great book.
Ext.onReady(function(){
// create the data store
var store = new Ext.data.JsonStore({
url: 'a_Json.php',
fields: [
{name: 'AufgabenNr', type: 'int'},
{name: 'Betreff', type: 'string'},
{name: 'Aktion_Soll_name', type: 'string'},
{name: 'AktionSollText', type: 'string'},
{name: 'Prioritaet', type: 'string'},
{name: 'Status', type: 'string'},
{name: 'Soll_Start', type: 'string'},
{name: 'Soll_Faelligkeit', type: 'string'},
{name: 'TimeStamp', type: 'string'},
{name: 'Datum_Erstellung', type: 'string'}
]
});
// load data from the url ( php file )
store.load();
// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'AufgabenNr', header: "ID", width: 25, sortable: true, dataIndex: 'AufgabenNr'},
{header: 'SollStart', width: 75, sortable: true, dataIndex: 'Soll_Start'},
{header: 'Aktion', width: 90, sortable: true, dataIndex: 'Aktion_Soll_name'},
{header: 'Betreff', width: 200, sortable: true, dataIndex: 'Betreff'},
{header: 'Soll Aktion', width: 130, sortable: true, dataIndex: 'AktionSollText'},
{header: 'Prio', width: 30, sortable: true, dataIndex: 'Prioritaet'},
{header: 'Status', width: 100, sortable: true, dataIndex: 'Status'},
{header: 'Ende', width: 75, sortable: true, dataIndex: 'Soll_Faelligkeit'},
{header: 'Erstellt', width: 75, sortable: true, dataIndex: 'Datum_Erstellung'},
{header: 'letzte Aenderung', width: 120, sortable: true, dataIndex: 'TimeStamp'}
],
stripeRows: true,
height:500,
width:950,
title:'Aufgaben Liste',
// click Event Listener
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: {
fn: function(sm,index,record) {
Ext.Msg.alert('You Selected', 'Your ID: ' +record.data.AufgabenNr);
}
}
}
})
});
// render grid
grid.render('a-grid');
/*
grid.on('rowdblclick', function(grid, rowIndex) {
Ext.Msg.alert('You Selected', rowIndex);
});
*/
});