联系官方销售客服
1835022288
028-61286886
【SelectPage模块DIY下拉分页实现】模块自定义的DIY字段改成SelectPage效果
$code = ''; // 最终输出的代码 $title=""; if($value>0) { $data = \Phpcmf\Service::M()->db->table(SITE_ID.'_模块表名')->where("id",$value)->get()->getRowArray(); $title=$data['title']; } $code.="<input type='text' name='data[".$name."]' value='".$value."' id='selectPage2' />"; $code.=" <link rel='stylesheet' href='/static/SelectPage/selectpage.css' type='text/css'> <script type='text/javascript' src='/static/SelectPage/selectpage.js' ></script> <script> $(function(){ $('.sp_container').css('width','400px'); }) var tag_data = ["; $data = \Phpcmf\Service::M()->db->table(SITE_ID.'_模块表名')->get()->getResultArray(); if ($data) { foreach ($data as $t) { $code.="{id:".$t['id']." ,name:'".$t['title']."',desc:'".$t['title']."'},"; } } $code.="]; //初始化插件 $('#selectPage2').selectPage({ showField : 'desc', keyField : 'id', data : tag_data });"; if(empty($value)) { //动态修改选中项目 $code.="$('#selectPage2').val('".$value."'); $('#selectPage2').selectPageRefresh();"; } $code.="</script> ";