0

当用户在我的树中选择一行或多行时,我想将行的 ID 设置到我的商店代理的 url 上。这是我当前的代码:

var treePanel = Ext.create('Ext.tree.Panel', {
    id: 'tree-panel',
    title: 'Taxonomy',
    region:'west',
    collapsible: true,
    split: true,
    multiSelect: true,                          
    height:'100%',       
    width: '20%',
    minWidth: 100,
    rootVisible: false,
    autoScroll: true,
    store: store,
    viewConfig: {
        allowCopy: true,
        plugins: {
            ptype:      'treeviewdragdrop',
            appendOnly: true,
            ddGroup:    'selDD'
        }
    }
});

这是我设置“选择”事件的代码:

treePanel.getSelectionModel().on('select', function(selModel, record) {
    var selectedNode = treePanel.getSelectionModel().getSelection();
    if (multiSelect,true) {
        treeID=selectedNode[0].data.id;
        //if(treeID = 'null'){
        store1.proxy.url='json/json.php?taxee_id=<?php echo $taxe_id;?>&id=' + selectedNode[0].data.id ;
        store1.load();
    }
    else
    {
        store1.proxy.url='json/json.php?taxee_id=<?php echo $taxe_id;?>&id=' + selectedNode[0].data.id + '&id1='+ selectedNode[1].data.id ;
        store1.load();
    }
});
4

1 回答 1

0

如果这是您唯一的问题,这对您有用:

treePanel.getSelectionModel().on('select', function(selModel, record) {
    var selectedNode = treePanel.getSelectionModel().getSelection();
    if(selectedNode.length > 0)
    {
        var proxyUrl = 'json/json.php?taxee_id=<?php echo $taxe_id;?>&id=' + selectedNode[0].data.id;
        for(var i = 1; i < selectedNode.length; i++)
            proxyUrl += '&id' + i + '='+ selectedNode[i].data.id;
        store1.proxy.url = proxyUrl;
        store1.load();
    }
});
于 2013-03-13T13:54:23.253 回答