zoukankan      html  css  js  c++  java
  • Extjs 4.1 学习笔记(一)(proxy,loader,treestore)

    Ext.data.HttpProxy在Extjs 4中为Ext.data.proxy.Ajax,Ext.data.HttpProxy的用法在5.0后会取消

    将页面加载到panel中

    Ext.create('Ext.panel.Panel', {
    itemId: ‘itemid’,
    title: ‘title’,
    loader: {
        url: taget_url,
        autoLoad: true,
        scripts: true,
        params: { key: _trans.text }
    }

    参数params会post到页面

    在Extjs4.1中proxy需要使用post传参数的话如下:

    Ext.create("Ext.data.Store", {
           fields: [
               { name: 'fields_name', mapping: 'code_c' },
               { name: 'fields_code', mapping: 'code_field_intable' }
           ],
           storeId: 's_ds',
           autoLoad: true,
           proxy: {
               type: 'ajax',
               url: 'page.aspx',
               actionMethods: { read: 'POST' },//参数会post到页面
               reader: 'json',
               extraParams: { key: 'key' }
           }
       })

    Ext.create('Ext.data.TreeStore',{
        //nodeParam : 'parentId',  //这个属性是异步加载主要特征,通过该节点去请求子节点,这个属性不设置,默认传到页面的key就是node
        proxy: {
            type: 'ajax',
            url: '../getdata/GetNavTree.aspx',
        },
        // 设置根节点
        root: {
            text: '根节点',
            id: 'Branch',
            expanded: true
        }
    });

    这样tree的节点就会动态加载,当然在server端还是要处理的

    if (Request["node"] == "Branch") then

    {

    返回包含Branch的json数据

    }elseif(Request["node"] == "leaf")

    {

    返回包含leaf的json数据

    }

  • 相关阅读:
    微信小程序-隐藏和显示自定义的导航
    微信小程序-注册和第一个demo
    QRCodeHelper 二维码生成
    Excel 操作
    angular 初体验
    angular 环境搭建
    代码注入
    c# 从一个服务器 访问另外一个服务器上的文件
    oracle 分组取第一行数据 ,查询sql语句
    软件项目验收需要的文档 ,谢谢补充
  • 原文地址:https://www.cnblogs.com/wallis0922/p/2790551.html
Copyright © 2011-2022 走看看