小编Chr*_*ris的帖子

无法让jQuery插件jsTree最初选择一个节点

我有jsTree从JSON页面加载数据,它正确显示.我试图默认选择根节点,但我不能让它工作.

这是我的jQuery:

$(function () {
    $("#demo1").jstree({ 
        "plugins" : [ "themes","json_data","ui" ],
        "json_data" : {
            "ajax" : {
                "url" : "categorytreejson.asp"
            },
            "ui" : {
                "initially_select" : [ "root" ]
            },
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

这是来自categorytreejson.asp的我的JSON,它使用JSONLint进行验证:

{
  "data": "root",
  "attr": {
    "id": "root"
  },
  "children": [
    {
      "data": "Photography",
      "attr": {
        "id": "Photography"
      },
      "children": [
        {
          "data": "Lenses",
          "attr": {
            "id": "Lenses"
          },
          "children": [
            {
              "data": "Telephoto",
              "attr": {
                "id": "Telephoto"
              }
            },
            {
              "data": "Macro",
              "attr": {
                "id": "Macro" …
Run Code Online (Sandbox Code Playgroud)

asp.net jquery json jstree

6
推荐指数
1
解决办法
8707
查看次数

很难理解Git和Github在我的网络服务器上的位置

我是一个很长时间的Web开发人员,刚开始使用Git和Github作为我的第一个项目.我已经设置了我的Github存储库,添加了一个README文件,将其提交并将其推送到我的原始主服务器.它现在出现在Github就好了.我假设我现在想要将其拉到,获取或克隆到我的实时网站.开发是在同一个实时服务器的一个单独的暂存区域完成的,所以我相信我所做的和提交的更改对于实时站点来说是可以的.我不是团队的一员,而且这是一个小项目,所以我最感兴趣的是保持代码备份和跟踪变化.

我是在正确的轨道上吗?我已经尝试了很多文章,但我认为我并没有把握它.

谢谢你的建议.

php git github

5
推荐指数
1
解决办法
754
查看次数

PHP代码一直有效,直到我成为一个函数

我在这里有这个代码,它给了我正在寻找的结果,一个格式很好的值树.

    $todos = $this->db->get('todos'); //store the resulting records
    $tree = array();                  //empty array for storage
    $result = $todos->result_array(); //store results as arrays

    foreach ($result as $item){
        $id = $item['recordId'];
        $parent = $item['actionParent'];
        $tree[$id] = isset($tree[$id]) ? $item + $tree[$id] : $item;
        $tree[$parent]['_children'][] = &$tree[];
    }

    echo '<pre>';
    print_r($tree);
    echo '</pre>';
Run Code Online (Sandbox Code Playgroud)

当我将foreach中的代码放入这样的函数中时,我得到一个空数组.我错过了什么?

    function adj_tree($tree, $item){
        $id = $item['recordId'];
        $parent = $item['actionParent'];
        $tree[$id] = isset($tree[$id]) ? $item + $tree[$id] : $item;
        $tree[$parent]['_children'][] = &$tree[];
    }

    $todos = $this->db->get('todos'); //store the resulting records …
Run Code Online (Sandbox Code Playgroud)

php arrays function

3
推荐指数
1
解决办法
125
查看次数

在使用drop或beforedrop监听器的ExtJS拖放树上似乎不会触发

我有一棵树在extjs.我已经添加了拖放插件,并且这些功能在浏览器中运行正常,但我需要将拖放更改发送到我的数据库中吗?要做到这一点,我相信我应该听取drop事件,然后对我的后端进行ajax调用.我有一个checkchange事件,可以激活,但是一滴或者之前甚至似乎什么都不做.

这是我的树的配置,我做错了什么?

todotree = {
    title: 'Tree Grid',
    width: 600,
    height: 400,
    viewConfig: {
        plugins: {
            ptype: 'treeviewdragdrop'
        }
    },
    store: new Ext.data.TreeStore({
        storeId: 'treestore',
        fields: [{
            name: 'actionTitle',
            type: 'string'
        }],
        proxy: {
            type: 'ajax',
            url: 'index.php/todo/listtree',
            reader: 'json'
        }
    }),
    rootVisible: false,
    columns: [
    {
        xtype: 'treecolumn',
        text: 'Title',
        flex: 3,
        dataIndex: 'actionTitle'
    }],
    listeners: {
        checkchange: function(node, checked){
            Ext.Ajax.request({
                url: 'index.php/todo/togglecheck/' + node.data.recordId + '/' + checked,
                success: function() {}
            });
        },
        drop: function(){ alert("drop") },
        beforedrop: …
Run Code Online (Sandbox Code Playgroud)

tree drag-and-drop extjs listener

2
推荐指数
1
解决办法
6151
查看次数

标签 统计

php ×2

arrays ×1

asp.net ×1

drag-and-drop ×1

extjs ×1

function ×1

git ×1

github ×1

jquery ×1

json ×1

jstree ×1

listener ×1

tree ×1