在extjs中传递两个id 4树multiSelect并单击中传递一个id [英] pass two id s in extjs 4 tree multiSelect and pass one id in single click

查看:116
本文介绍了在extjs中传递两个id 4树multiSelect并单击中传递一个id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When a user selects one or many rows in my tree, I would like to set the row's IDs onto the url of my store proxy. Here is my current code:

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

这里是我设置'select'事件的代码:

And here is the code where I am setting the 'select' event:

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


推荐答案

这将为您工作,如果这是您唯一的问题:

This will work for you if that is your only problem:

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

这篇关于在extjs中传递两个id 4树multiSelect并单击中传递一个id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆