在ExtJS的传递两个ID号第4条树多选,并通过在单一的点击一个ID(pass two id s i

2019-11-01 18:41发布

当用户选择在我的树的一个或多个行,我想设置行的标识到我店代理的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();
    }
});

Answer 1:

这会为你工作,如果这是你唯一的问题:

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();
    }
});


文章来源: pass two id s in extjs 4 tree multiSelect and pass one id in single click
标签: Extjs extjs4