动态加载控件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',
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>"}]}' ;
}
}