暂时保存下代码
<?php $tm=eregi_replace("\.","", microtime(true))?>
<div id="6677_datagrid_<?=$tm?>"style="padding:5px"></div>
<div id="6677_reecontrol_win_<?=$tm?>">
<form id="6677_reecontrol_<?=$tm?>" method="post">
<table border="0" width="100%">
<tr>
<td width="100">控件类型:</td>
<td>
<select class="easyui-combobox" name="ca_type" >
<option value="6">复选框</option>
<option value="7">单选框</option>
<option value="5">下拉菜单</option>
</select>
</td>
</tr>
<tr>
<td width="100">控件名称:</td>
<td><input class="easyui-validatebox" type="text" name="ca_name" data-options="required:true,validType:'length[2,32]'"></input></td>
</tr>
<tr>
<td width="100" valign="top">控件描述:</td>
<td><input class="easyui-validatebox" type="text" name="ca_descr" data-options="required:true,validType:'length[0,32]'"></input></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="提交新建" ></td>
</tr>
</table>
</form>
</div>
<div id="6677_Modifythecontrol_<?=$tm?>">
<form id="6677_Modify_<?=$tm?>" method="post">
<table border="0" width="100%">
<tr>
<td width="100">控件类型:</td>
<td>
<select class="easyui-combobox" name="ca_type" id="6677_ca_type_<?=$tm?>">
<option value="6">复选框</option>
<option value="7">单选框</option>
<option value="5">下拉菜单</option>
</select>
</td>
</tr>
<tr>
<td width="100">控件名称:<input type="hidden" name="ca_id" id="6677_ca_id_<?=$tm?>" value=""></td>
<td><input class="easyui-validatebox" type="text" name="ca_name" id="6677_ca_name_<?=$tm?>" data-options="required:true,validType:'length[2,32]'"></input></td>
</tr>
<tr>
<td width="100" valign="top">控件描述:</td>
<td><input class="easyui-validatebox" type="text" name="ca_descr" id="6677_ca_descr_<?=$tm?>" data-options="required:true,validType:'length[0,32]'"></input></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="提交新建" ></td>
</tr>
</table>
</form>
</div>
<div id="7788_sorting_win_<?=$tm?>"></div>
<script>
$('#6677_datagrid_<?=$tm?>').datagrid({
fit: true,//自适应父窗口大小
rownumbers:'true',
striped: true,//隔行变色
sortOrder: 'desc',//排序规则只能是'asc'或'desc'。默认asc。
remoteSort: false,//服务器端排序
singleSelect:'true',//单项
border:'false',
url:'http://testui.com/index.php/admin/category/ajaxGetComponentList',
loadMsg:'正在加载数据请稍后...',
frozenColumns:[[//冻结固定设置数据绑定
{field:'ca_name',title:'控件名称',width:150}
]],
columns:[[//设置数据绑定
{field:'compontenname',title:'控件类型',width:150,sortable:true},
{field:'ca_value',title:'控件值',width:150,sortable:true}
]],
loadFilter: function(data)
{
var data = errorHandler(data);
return data['data'];
},
toolbar:[{
text:'增加属性',
iconCls:'icon-remove',
handler:function(){
$('#6677_reecontrol_<?=$tm?>').form({//对表单进行渲染
url:'http://testui.com/index.php/admin/6677/ajaxUpComponent',
onSubmit: function(){
return $(this).form('validate');//对表单进行验证
},
success:function(data){
var data = errorHandler(data);
if(data['code'] == 0){//获得后台json的消息代码判断是否成功
$('#6677_datagrid').datagrid('reload');//刷新数据
$.messager.alert("OK","编辑成功");
$('#6677_reecontrol_<?=$tm?>').form('clear');
$('#6677_reecontrol_win_<?=$tm?>').window('close');
}
}
});
winDiv("增加属性","300","150","6677_reecontrol_win_<?=$tm?>","icon-add");
}
},{
text:'删除属性',
iconCls:'icon-remove',
handler:function(){
var row = $('#6677_datagrid_<?=$tm?>').datagrid('getSelected');//获取单选值
if(row == null){
$.messager.alert("提示","请选择要删除的控件!");
}else{
$.messager.confirm("提示","确认删除?",function(r){
if(r){
$.ajax({
url:'http://testui.com/index.php/admin/6677/ajaxChangeComponentState/'+row.id,
datatype: "text",
success: function(data) {
var data = errorHandler(data);
if(data['code'] == 0){//获得后台json的消息代码判断是否成功
$('#6677_datagrid_<?=$tm?>').datagrid('reload');//刷新数据
$.messager.alert("OK","删除成功");
}
}
});
}
}
);
}
}
},{
text:'修改属性',
iconCls:'icon-edit',
handler:function(){
var row = $('#6677_datagrid_<?=$tm?>').datagrid('getSelected');//获取单选值
if(row == null){
$.messager.alert("提示","请选择控件")
}else{
$("#6677_ca_name_<?=$tm?>").val(row.ca_name);
$("#6677_ca_descr_<?=$tm?>").val(row.ca_descr);
$("#6677_ca_id_<?=$tm?>").val(row.id);
$('#6677_ca_type_<?=$tm?>').combobox('select',row.ca_type)//设置选中的值
$('#6677_Modify').form({//对表单进行渲染
url:'http://testui.com/index.php/admin/6677/ajaxUpComponent/'+row.id, ///参数
onSubmit: function(){
return $(this).form('validate');//对表单进行验证
},
success:function(data){
var data = errorHandler(data);
if(data['code'] == 0){//获得后台json的消息代码判断是否成功
$('#6677_datagrid_<?=$tm?>').datagrid('reload');//刷新数据
$.messager.alert("OK","修改属性成功");
$('#6677_Modifythecontrol_<?=$tm?>').window('close');
}
}
});
winDiv("修改属性","300","150","6677_Modifythecontrol_<?=$tm?>","icon-add");
}
}
},{
text:'属性排序',
iconCls:'icon-remove',
handler:function(){
var row = $('#6677_datagrid_<?=$tm?>').datagrid('getSelected');//获取单选值
if(row == null){
$.messager.alert("提示","请选择您要排序的分类","warning");
}else{
$('#7788_sorting_win_<?=$tm?>').dialog({
title: '排序',
width: 350,
closed: false,
cache: false,
href: '7788.php',
modal: true,
onLoad:function(){
$('#a_sorting_form').form({
url:'http://testui.com/index.php/admin/category/ajaxChangeCategorySort',
onSubmit: function(){
return $(this).form('validate');//对表单进行验证
},
success:function(data){
var data = errorHandler(data);
if(data['code'] == 0){//获得后台json的消息代码判断是否成功
$('#category_tree').treegrid('reload');//刷新数据
$('#ca_sorting_win').dialog('close');//添加成功后关闭窗口
$.messager.alert("OK","修改成功");
}
}
});
},
buttons:[{
text:'确定',
iconCls:'icon-ok',
handler:function(){
$('#a_sorting_form').submit();
}
}]
});
}
}
}]
});
</script>