String cookieName="Sender";
Cookie cookie=new Cookie(cookieName, "userToken");
cookie.setMaxAge(5*365*24*60*60); //存活期为10秒
response.addCookie(cookie);%>
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px0;
}
@media (max-width: 980px) {/*Enable use of floated navbar text*/.navbar-text.pull-right {float: none;
padding-left: 5px;
padding-right: 5px;
}
}
#uninotatable tr td{ overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
}
名称:
奖励:
下载次数:
是否上架:
请选择
已上架
未上架
软件图标:
下载链接:
描述:
var Grid=Grid,
Store=Data.Store,
enumObj= {"1" : "选项一","2" : "选项二","3" : "选项三"},
columns=[
{
title:'id',
dataIndex:'id',
visible:false,
editor: {
xtype:'text',
rules: {
required:true}
}
},
{
title:'软件名称',
dataIndex:'name',
editor: {
xtype:'text',
rules: {
required:true}
}
},
{
title:'奖励宝币',
dataIndex:'share_jiangliscore',
editor: {
xtype:'text',
rules: {
required:true}
},//renderer: Grid.Format.dateRenderer
},
{
title:'下载次数',
dataIndex:'installtimes',
editor: {
xtype:'text',
rules: {
required:true},
},//renderer: Grid.Format.dateRenderer
},
{
title:'是否上架',
dataIndex:'isornoup',
editor: {
xtype:'text'}
}
,
{
title:'描述',
dataIndex:'description',
width:200,
editor: {
xtype:'text'}
}
,
{
title:'软件logo',
dataIndex:'imageurl',
width:300,
visible:false,
editor: {
xtype:'text'}
}
,
{
title:'下载链接',
width:300,
visible:false,
dataIndex:'loadurl',
editor: {
xtype:'text'}
},
{title :'操作',renderer : function(){return '编辑'}}
];
var editing= newGrid.Plugins.DialogEditing({
contentId :'content', //设置隐藏的Dialog内容
triggerCls : 'btn-edit', //触发显示Dialog的样式
editor: {
title:'编辑'},
autoSave :true //自动添加和更新
}),
store= newStore({
autoLoad:true,
url :"<%=basePath%>/softUninoLoad",//autoSync : true,//保存数据后自动调用store.load()方法
proxy : {
method :'POST', //更改为POST
save : {
addUrl :"<%=basePath%>/softUninoRowAdd",
removeUrl:"<%=basePath%>/softUninoRowRemove",
updateUrl :"<%=basePath%>/softUninoRowUpdate"}
}
}),
grid= newGrid.Grid({
render:'#grid',
loadMask:true,
bbar: {//pagingBar:表明包含分页栏
pagingBar:true},
columns : columns,
width :1100,
forceFit :true,
tbar:{//添加、删除
items : [{
btnCls :'button button-small',
text :'添加',
listeners : {'click': addFunction
}
},
{
btnCls :'button button-small',
text :'删除',
listeners : {'click': delFunction
}
}]
},
plugins : [editing,Grid.Plugins.CheckSelection],
store : store
});
grid.render();//保存成功时的回调函数,其实更好的方式是直接在保存成功后调用store.load()方法,更新所有数据
store.on('saved',function (ev) {
var type= ev.type, //保存类型,add,remove,update
saveData = ev.saveData, //保存的数据
data = ev.data; //返回的数据//TO DO
if(type == 'add'){ //新增记录时后台返回id
if(data.status=="success")
{
saveData.id=data.id;
grid.updateItem(saveData);
store.update()
BUI.Message.Alert('添加成功!');
}else{
BUI.Message.Alert('添加失败!');
}
}else if(type == 'update'){if(data.status=="success")
{
BUI.Message.Alert('更新成功!');
}else{
BUI.Message.Alert('更新失败!');
}
}else{if(data.status=="success")
{
BUI.Message.Alert('删除成功!');
}else{
BUI.Message.Alert('删除失败!');
}
}
});//保存或者读取失败
store.on('exception',function (ev) {
BUI.Message.Alert(ev.error);
});//添加记录
function addFunction(){
var newData= {b : 0};
editing.add(newData,'a'); //添加记录后,直接编辑
}//删除选中的记录
function delFunction(){
var selections=grid.getSelection(),
ids=BUI.Array.map(selections,function (item) {returnitem.id;
});
store.remove(selections);
store.save('remove',{ids : ids.join(',')}); //save的第三个参数是回调函数
}
});