jQuery easyui 结合ThinkPHP使用,关于读取数据显示有关问题

WBOY
Release: 2016-06-13 11:59:33
Original
876 people have browsed it

jQuery easyui 结合ThinkPHP使用,关于读取数据显示问题
原来项目写了一个EasyUI类,里面写了一个datagrig()方法
 public function _datagrid($tag) {
        $id    = !empty($tag['id']) ? $tag['id'] : strtolower(CONTROLLER_NAME.'_'.ACTION_NAME.'_datagrid');
        $style = !empty($tag['style']) ? $tag['style'] : '';
        //默认参数
     $dataOptions = array(
     'border'       => false,
     'fit'          => true,
     'fitColumns'   => true,
     'rownumbers'   => true,
     'singleSelect' => true,
     'pagination'   => true,
         'pageList'     => array(20,30,50,80,100),
         'pageSize'     => cookie('pagesize') ? cookie('pagesize') : C('DATAGRID_PAGE_SIZE'),
     );
     $options = $tag['options'] ? $this->autoBuildVar($tag['options']) : 'array()';
        $fields  = $tag['fields'] ? $this->autoBuildVar($tag['fields']) : 'null';
        
        $parseStr = '

\' style="'. $style .'">';
        $parseStr .= '$arr):if(isset($arr[\'formatter\'])):unset($arr[\'formatter\']);endif;echo "";endforeach;endif; ?>';
        $parseStr .= '
".$key."
';
        
        return $parseStr;
    }
控制器里是这样写的逻辑
$datagrid = array(
                'options'     => array(
                    'title'   => $currentpos,
                    'url'     => U('Uc/pages', array('grid'=>'datagrid')),
                    'toolbar' => 'uc_pages_datagrid_toolbar',
                ),
                'fields' => array(
                    'page'      => array('field'=>'page','width'=>15,'sortable'=>true),
                    'Access'    => array('field'=>'private','width'=>15,'sortable'=>true),
                    '管理操作'    => array('field'=>'id','width'=>15,'formatter'=>'ucPagesOperateFormatter'),
                )
            );


            $this->assign('datagrid', $datagrid);
页面是这样引用标签的,数据就出来了




现在的问题是,这是操作的pages表,里面有字段id ,page ,private,private的值是0或者1,控制器里利用field=》‘private'将0或者1显示到了页面上,但是我们的要求是当数据库privat字段值是0时页面显示public,是1时,页面显示private。不改变表的内容,结构,也就是不动表,怎样操作才能实现呢?请大家帮我看看,谢谢!
------解决方案--------------------

------解决方案--------------------
呃,会easyUI,不会php
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!