ext4页面局部刷新问题

a2048763 2013-09-04 04:30:52
我想实现 当我添加数据的时候 让页面部分刷新 让表格的panel刷新 来显示我新添加的数据
具体方法是什么呢 网上找不到~
var productPanel = new Ext.Panel({ //这个是我表格的名字

success:function(form,action){
Ext.Msg.alert("添加成功!");
win.hide();
//想在这里添加方法 刷新我的表格~
},
谢谢啦~
...全文
389 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
a2048763 2013-09-04
  • 打赏
  • 举报
回复
引用 4 楼 showbo 的回复:
store在你的success回调函数作用区域内,直接store.reload()就行了 success:function(form,action){ Ext.Msg.alert("添加成功!");这边添加成功的时候 刷新 页面的store win.hide(); store.reload() },
谢谢 会了~
Go 旅城通票 2013-09-04
  • 打赏
  • 举报
回复
store在你的success回调函数作用区域内,直接store.reload()就行了 success:function(form,action){ Ext.Msg.alert("添加成功!");这边添加成功的时候 刷新 页面的store win.hide(); store.reload() },
a2048763 2013-09-04
  • 打赏
  • 举报
回复
引用 1 楼 showbo 的回复:
panel里面都有什么,如果只是html显示内容,加个id,document.getElementById('xxx').innerHTML='aaaaaaaa'就行了

var productPanel = new Ext.Panel({ html:'<div id="dv">fafefefef</div>'});


success:function(form,action){
Ext.Msg.alert("添加成功!");
win.hide();
document.getElementById('dv').innerHTML='aaaaaaaa;

},

panel里面就是ext添加用户成功~ 如果要显示store里面的内容呢代码如下
	Ext.onReady(function() { 
var store= Ext.create('Ext.data.Store', {
fields: ['id', 'username', 'password'],
proxy: {
type: 'ajax',
url:'userlogin!list.action',
reader: {
type: 'json',
root: 'users' //刷新这个grid~
}
},
autoLoad:true
});

var productPanel = new Ext.Panel({
title : ' 模块 1 ',
//layout : 'fit',
id:'productPanel',
bbar : [{
text : '添加',
iconCls : 'add',
handler :showAddBook
}, {
text : '删除',
iconCls : 'remove'
}, {
text : '修改',
iconCls : 'option'
}
],
defaults : {
// applied to each contained panel
bodyStyle : 'padding:0px'
},
layout: {
type: 'accordion',
animate: true

},
items : [{
title : '参数配置',
xtype: 'grid',//刷新这个grid~
columns: [
{ text: 'Id', dataIndex: 'id' },
{ text: 'Username', dataIndex: 'username', flex: 1 },
{ text: 'Password', dataIndex: 'password' }
]
,store:store

},{
title : '参数配置',
html : '<P align="center"><a href="http://www.baidu.com" target="ifrMID">想看百度就点我</a></p>'
},
{
title : '参数配置',
html : '<p>这是参数配置</p>'
}]
});

var systemconfPanel= new Ext.Panel({
title : ' 模块2 ',
//layout : 'fit',
id:'systemconfPanel',
defaults : {
// applied to each contained panel
bodyStyle : 'padding:0px'
},
layout: {
type: 'accordion',
animate: true
},
items : [{
title : '系统初始化',
html : '<p>这是系统初始化</p>'
}, {
title : '参数配置',
html : '<p>这是参数配置</p>'
}, {
title : '知识管理',
html : '<p>这是知识管理</p>'
}]
});

var viewport = new Ext.Viewport({
layout : 'border',
renderTo : Ext.getBody(),
items : [//viewport的ITEM开始
//北方
{
title : '<marquee width="400px">This is ext</marquee>',
id : "north",
region : 'north',
xtype : 'panel',
spilt : true,
height : 120,
html : '<p>GPS导航业务</p>',
bbar : [{
iconCls : 'add',
text : '管理员'
}, '-', {
text : Ext.Date.format(new Date(), 'Y年m月d日 a g:i ')
}, '->', {
text : '退出',
iconCls : 'remove'

}],
bodyStyle : 'backgroud-color:#99bbe8;line-height : 50px;padding-left:20px;' +
'font-size:22px;color:#000000;font-family:黑体;font-weight:bolder;'+
'background: -webkit-gradient(linear, left top, left bottom, ' +
'color-stop(0%, rgba(153,187, 232, 0.4) ),' +
'color-stop(50%, rgba(153, 187, 232, 0.8) ),' +
'color-stop(0%, rgba(153, 187, 232, 0.4) ) );'
},
//西方
{
title : '菜单',
region : 'west',
iconCls : 'option',
id : 'west', // see Ext.getCmp() below
width: 280, // give east and west regions a width
minSize: 175,
maxSize: 400,
margins: '0 0 0 0',
collapsible: true,
split: true,
layout: 'fit', // specify layout manager for items
items: // 西部的ITEM开始 // this TabPanel is wrapped by another Panel so the title will be applied
new Ext.TabPanel({
activeTab : 0,
width : 200,
defaults : {
autoScroll : true
},
items :
[productPanel,
systemconfPanel
]

})//tabPanel结束

//西部ITEM的结束
},

//中间
{
title : '中间',
region : 'center',
xtype : 'panel',
html: '<iframe frameborder="0" marginheight="0" width="100%" height="100%" marginwidth="0" scrolling="auto" name="ifrMID"></iframe>',
spilt : true
}]
//viewport的ITEM结束
});
var bookForm = new Ext.FormPanel({
labelSeparator: ":",
frame:true,
border:false,
items:[
{
xtype:'hidden',
name:'id'
},{
xtype:'textfield', //文本区
width:220,
allowBlank:false,
blankText:'用户名不能为空',
name:'user.username',
fieldLabel:'用户名 '
},{
xtype:'textfield',
width:220,
allowBlank:false,
blankText:'密码不能为空',
name:'user.password',
fieldLabel:'密码'
}
],
buttons:[
{
text:'关闭',
handler:function(){
win.hide();
}
},{
text:'提交',
handler:function(){
if(bookForm.getForm().isValid()) {
Ext.MessageBox.show({
title:'请等待',
msg:'正在加载',
progressText:'',
width:300,
progress:true,
closable:'false',
animEl:'loding'
});
var f = function(v){
return function(){
var i=v/11;
Ext.MessageBox.updateProgress(i,'');
}
}
for(var i=1;i<33;i++){
setTimeout(f(i),i*1500);
}
//提交到服务器操作
bookForm.form.doAction('submit',{
url:'userlogin!add.action',
method:'post',
success:function(form,action){
Ext.Msg.alert("添加成功!");///这边添加成功的时候 刷新 页面的store
win.hide();


},
failure:function(form,action){
Ext.Msg.alert("添加失败!",action.result.message);
}
});
}
}
}
]
});
Go 旅城通票 2013-09-04
  • 打赏
  • 举报
回复
panel里面都有什么,如果只是html显示内容,加个id,document.getElementById('xxx').innerHTML='aaaaaaaa'就行了 var productPanel = new Ext.Panel({ html:'<div id="dv">fafefefef</div>'}); success:function(form,action){ Ext.Msg.alert("添加成功!"); win.hide(); document.getElementById('dv').innerHTML='aaaaaaaa; },

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧