一、經過form頁面元素數據填充javascript
$('#<?php echo NS;?>form').form('load',<?php echo json_encode($orm->as_array());?>);//loadYiXia
試圖頁源碼:php
<form id="<?php echo NS;?>form" method="post" enctype="multipart/form-data" onsubmit="return <?php echo NS;?>submit();" style="margin:0;padding:10px 50px">
<div style="margin:5px">
<input id="<?php echo NS;?>web" name="platform" style="width:300px;"
data-options="label:'*站點:',prompt:'選擇站點',required:true" />
</div>
<div style="margin:5px">
<input class="easyui-textbox" name="name" style="width:300px;"
data-options="label:'*廣告位置:',prompt:'廣告位置',required:true" />
</div>
<div style="margin:5px">
<input class="easyui-textbox" name="node" style="width:300px;"
data-options="label:'*標識名稱:',prompt:'標識名稱,例:aa_bb_1,_aa_bb_1',required:true" />
</div>
<div style="margin:5px">
<input class="easyui-numberbox" name="width" style="width:300px;"
data-options="label:'*寬度:',prompt:'建議寬度(單位:像數)',required:true" />
</div>
<div style="margin:5px">
<input class="easyui-numberbox" name="height" style="width:300px;"
data-options="label:'*高度:',prompt:'建議高度(單位:像數)',required:true" />
</div>
<div style="margin:5px">
<input class="easyui-textbox" name="nopic" style="width:300px;"
data-options="label:'默認圖片:',prompt:'默認廣告圖',required:false" />
</div>
<div style="margin:5px">
<input class="easyui-textbox" name="remark" style="width:300px;"
data-options="label:'備註:',prompt:'備註',required:false" />
</div>
</form>
<script type="text/javascript">
$(document).ready(function(){
$('#<?php echo NS;?>form').form('load',<?php echo json_encode($orm->as_array());?>);//loadYiXia
//站點選擇
$('#<?php echo NS;?>web').combobox({
valueField: 'id',
textField: 'name',
panelHeight: 180,
editable: false,
data:<?php echo $web;?>,
onLoadSuccess:function(){
}
});
//下拉框展開收縮動畫
$('#<?php echo NS;?>web').combobox('panel').panel({
openAnimation:'slide',
closeAnimation:'hide'
});
});
function <?php echo NS;?>submit()
{
$.ajax({
type: 'POST',
url: '/advertise/config/ajax_<?php echo Request::current()->action();echo Request::current()->action()=='update'?'/'.$orm->pk():'/0';?>',
data: $('#<?php echo NS;?>form').serialize(),
dataType: "json",
beforeSend: function(xhr){
if($('#<?php echo NS;?>form').form('validate')){
$.messager.progress();
return true;
}
return false;
},
success: function (res) {
$.messager.progress('close');
if(res.status == 200){
$("#<?php echo NS;?>form").parent().dialog("close");
$.messager.alert('操做提示',res.msg,'info');
return true;
}
$.messager.alert('操做提示',res.msg,'error');
}
});
return false;
}
</script>
print_r($orm->as_array())輸出html
array ( 'id' => '56', 'reorder' => '0', 'position' => '1', 'name' => 'text', 'picurl' => '', 'admode' => 'URL', 'linkurl' => '', 'codebox' => NULL, 'cityid' => '0', '_cityid' => '全國', 'starttime' => '2018-11-15 10:49:15', 'endtime' => '2018-11-15 10:49:18', 'views' => '0', 'remark' => '', 'status' => '1', 'modtime' => '1542261489', 'addtime' => '1542250225', )
二、EassUI動態改變參數java
$("#<?php echo NS; ?>corper").datagrid("options").queryParams.belongcityid = val; $('#<?php echo NS; ?>corper').datagrid('reload');