3

我想通过在 extjs 中发送 id 属性突出显示特定行来加载网格。我暂时无法选择记录。我该怎么做?谢谢....

我尝试了一些代码中注释的代码。你可以在下面看到。

var GrideAktar = function (bilgim) {
    arr = bilgim.split(",");
    bilgi = arr[0];
    secilecek_id = arr[1];

    harita.hide();
    izgaralar.hide();
    chartlar.hide();
    izgara_yp_is_emirleri.hide();


    izgaralar.show();
    izgaralar.setHeight(merkez.getHeight());
    fileStore_yon.loadById(bilgi);
    tree.treeRefresh();

    cuIzgaraKay = null;
    cuAgacNode = bilgi;
    cuAgacSeciliNode = NodeParser(bilgi);
    cuAgacSeciliSehir = SehirParser(bilgi)
    fileGrid_yon.setHeight(merkez.getHeight());
    //fileGrid_yon.getSelectionModel().selectFirstRow();
    //fileGrid_yon.getSelectionModel().valueOf(id);
    //fileGrid_yon.getSelectionModel().selectRow(1);

    //   var idx = fileGrid_yon.getStore().indexOfId(secilek_id);
    //var rowEl = fileGrid_yon.getView().getRow(idx);
    //rowEl.scrollIntoView(fileGrid_yon.getGridEl(),false);
    Ext.select(secilecek_id);
    raporAlanListesiWindow.hide();
    //fileGrid_yon.getSelectionModel().selectRow( this.getStore().indexOfId(id) ); //raporSecenekleriForm.hide(); 
}
4

3 回答 3

8

利用:

grid.getSelectionModel().select(store.getById(id));

它将选择 instoreid的记录grid

于 2013-03-06T14:54:00.303 回答
1
var index = gridPanel.store.find('fieldName', fieldValue);
gridPanel.getSelectionModel().select(gridPanel.store.getAt(index));
于 2013-12-11T21:02:03.377 回答
1

这看起来像一个竞争条件问题。我猜你的代码创建了一个使用 ajax 或其他东西从远程源加载的网格。尝试在商店的“加载”事件中嵌入行选择代码:

var GrideAktar = function (bilgim) {
    arr = bilgim.split(",");
    bilgi = arr[0];
    secilecek_id = arr[1];

    harita.hide();
    izgaralar.hide();
    chartlar.hide();
    izgara_yp_is_emirleri.hide();


    izgaralar.show();
    izgaralar.setHeight(merkez.getHeight());
    fileStore_yon.on("load", function(){
        fileGrid_yon.getSelectionModel().select(fileStore_yon.getById(id));
    });
    fileStore_yon.loadById(bilgi);
    tree.treeRefresh();

    cuIzgaraKay = null;
    cuAgacNode = bilgi;
    cuAgacSeciliNode = NodeParser(bilgi);
    cuAgacSeciliSehir = SehirParser(bilgi)
    fileGrid_yon.setHeight(merkez.getHeight());
    //fileGrid_yon.getSelectionModel().selectFirstRow();
    //fileGrid_yon.getSelectionModel().valueOf(id);
    //fileGrid_yon.getSelectionModel().selectRow(1);

    //   var idx = fileGrid_yon.getStore().indexOfId(secilek_id);
    //var rowEl = fileGrid_yon.getView().getRow(idx);
    //rowEl.scrollIntoView(fileGrid_yon.getGridEl(),false);
    Ext.select(secilecek_id);
    raporAlanListesiWindow.hide();
    //fileGrid_yon.getSelectionModel().selectRow( this.getStore().indexOfId(id) ); //raporSecenekleriForm.hide(); 
}
于 2013-03-06T16:14:54.203 回答