PDA

View Full Version : grid and selected row



mnask79
6 Oct 2009, 11:51 PM
hi ,

i have grid and i reload the grid store ever 10 seconds

i have fixed the issue related scroll , but my problem now when i reload the data store , i lose the selection on the row . this is my script




sendRequest = function(params) {
Ext.Ajax.request({
url:url (http://www.extjs.com/forum/url),
params: params,
method:'POST',
//failure: onFailure,

callback: function(opts,suss,resp) {
var result = Ext.decode(resp.responseText);
if (result)
var state = tickers_grid.getView();
console.log(state);
//tickers_grid.getView().restoreScroll(state);
ticketsDs.loadData(result);

}
})
}

startSendRequest = function(){
sendRequest({displayAll:'true',jsonCall:'true'});
sortInfo = ticketsDs.getSortState();
ticketsDs.sort(sortInfo.field,sortInfo.direction);
}

ticketsDs.on('load',stopMsg);
function stopMsg (){
myMask.hide();
}

var tickersRefresh = {
run: startSendRequest,
interval: 10000 //10 second
}
Ext.TaskMgr.start(tickersRefresh);


var tickers_grid = new Ext.grid.GridPanel({
region:'center',
frame:false,
border:false,
layout:'fit',
store: ticketsDs,
columns: [
{id:'ticketId',header: "Ticket Id", width:70, sortable: true, dataIndex: 'ticketId'},
{header: "Creator", width:140 , sortable: true, dataIndex: 'fullname'},
{header: "Assigned To", width:140 , sortable: true, dataIndex: 'assigned'},
{header: "Customer", width:140 , sortable: true, dataIndex: 'customer'},
{header: "Category", width:110 , sortable: true, dataIndex: 'catName'},
{header: "Sub Category", width:110 , sortable: true, dataIndex: 'subCatName'},
{header: "Ticket Time", width:130 , sortable: true, dataIndex: 'curTime'},
{header: "Updated Ticket Time", width:130 , sortable: true, dataIndex: 'updTime'},
{header: "Status", sortable: true, width:90 ,renderer: statusType, dataIndex: 'status'},
{header: "Priority", sortable: true, width:90 , renderer: priority, dataIndex: 'priority'},
{header: "Zone", sortable: true, width:80, dataIndex: 'zone'}
],
stripeRows: true,
view: new Ext.grid.GroupingView({
onLoad: Ext.emptyFn,
forceFit:true,
groupTextTpl: '{text} {[values.rs.length]} {[values.rs.length > 1 ? "Tickets" : "Ticket"]}'
}),
listeners:{rowcontextmenu:showMenu,cellclick:checkBtn} ,
loadMask : true ,
width:1020,
title:'Tickets'
});


so how i can keep the selection on the row when i reload the data store ?
regards

mnask79
7 Oct 2009, 11:12 AM
why nobody answer me !!

is it wrong question ??