动态加载控件store

动态加载控件store
 
控件里面的一部分。
 //构造器
    constructor: function(config){
 
        var flag = this.store == null;
        if(flag){
            this.store = new Ext.data.JsonStore({
                id: this.ID,
                autoLoad : false,
                url: this.baseUrl + "/ListAll",//默认的数据源地址,继承时需要提供
                 baseParams :{type:9},
                root: "data",
                totalProperty: "totalCount",
// remoteSort: true,
                fields: this.storeMapping
            });
        } 
 
js页面中使用传值
create_tem_pay:function(){
        var pay =new TempViewPanel();  //new一个控件
        var paystore = pay.gridPanel.getStore(); //得到 store
        Ext.apply(
            paystore.baseParams,{
                limit:20,
                type : 0, 
                start :0
            });  //重新赋值
        paystore.reload(paystore.baseParams);  //手工加载
        var tem_pay_win;
        if(!tem_pay_win){
            tem_pay_win = new Ext.Window({
                layout:'fit',
                width:650,
                height:456,
                collapsible:true,
                maximizable:true,
                closeAction:'hide',
                bodyStyle:'padding:5px;',
                title: '接口充值类',
                modal:true,
                plain: true,
                items:[pay]
            });
        }
        tem_pay_win.show();
 
控制器里面的列表
//列表
    function ListAll()
    {
        /*echo $type = $_POST['type'] ;
          if($type == 1 || $type == 2 || $type == 3 || $type == 4 || $type == 0 || $type == 5 || $type == 6 || $type == 7){
              $sql = "select * from interface where gameid=-1 and opt_type=".$type ;
          } */
        $sql = "select * from interface where gameid=-1";
        $info = $this->db->query($sql);
        $result = $info->result_array();
        $count=$info->num_rows();
        if($count>0)
        {
            $result = json_encode($result);
            echo '{"totalCount":'.$count.',"data":'.$result.'}' ;
        }
        else
        {
            echo '{"totalCount":'.$count.',"data":[{"id":"0","name":"<font color=red><b>暂无记录</b></font>"}]}' ;
        }
    }
 
 

转载于:https://www.cnblogs.com/holyes/archive/2012/06/26/7a31a534f52495cd8b233318cea9ce16.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值