### 批量設置數據列
~~~
return TBuilder('table',$this)->addTopButton([ //添加頂部按鈕
'type' => 'add',
'icon_class'=> 'fa fa-plus-circle',
'href' => url('add',['module'=>$module]),
])
->addTopButton([
'type' => 'custom',
'title' => '列表查看',
'icon_class'=> 'fa fa-list',
'href' => url('index',['module'=>$module]),
])
->setColumns([ // 批量設置數據列
['id', 'ID'],
['title.text', '名稱'], //以普通文本編輯
['pid', '上級菜單',['func'=>'get_parent_menu_name']],
['user_id', '用戶',['table_field'=>'admin_member|username'] ],
['pro_cover_id', '封面', ['type'=>'img']], //顯示圖片(傳入圖片ID)
['group', '分組',],
//['group_id.select', '分組',['data'=>M('Group')->select(),'data_field'=>'id|title']],
['url', 'URL',['type'=>'url', 'url'=>'menu/index', 'p'=>'id.pid']],
['icon_class', 'ICON',],
['sort', '排序',],
['description.textarea', '描述',], //以多行文本編輯
['status.select', '狀態',['func'=>'c_name','config_name'=>'status'] ],
['is_dev', '僅開發者模式顯示', ['func'=>'yes_no']],
['hide', '隱藏', ['func'=>'yes_no']],
['edit.edit_data|id+title,del', '操作', ['type'=>'btn']]
])
// 添加相關操作按鈕
->addListButton([
'type' => 'edit',
'icon_class'=> 'fa fa-pencil',
])
->addListButton([
'title' => '別表查看',
'href_base' => 'menu/index',
'href_param'=> 'pid.id',
'icon_class'=> 'fa fa-list',
])
->fetch();
~~~
### setColumns參數為多維數組
>
* 批量設置數據列
* @param array $columns
* [[field,name,config]]
* 參數1 字段信息
* field展示類型,如果可以直接編輯則以.號分割,其后加入編輯類型
* 參數2 字段名稱
* 參數3 展示配置
* type 展示類型
* field // field . xedit type
* url
* btn // type . url | 參數
*
* //type為field,對顯示內容進行二次處理的函數
* func 對字段處理的函數名稱,參數為當前值
* func_param 當存在對字段處理的函數時,此值為為該函數的第二個參數
*
* config_name 配置參數名。當func為c_name時且func_param未傳值,此值可替代func_param。
* 當type為field且可編輯時,此為編輯選擇數據源。
*
* //附加數據select2
* data 下拉的數據
* data_field 使用的字段,使用 | 分割值與顯示用字段,'id|name'
*
* table_field 獲取指定表的指定字段的值,使用 | 分割表與表字段(影響速度,不建議使用)
*
* icon_prefix_class_field 前置圖標字段名稱
* icon_prefix_class 前置圖標class值
*
* //type為btn有效
* btn_config 按鈕相關配置
*
* //type為url有效
* url 展示類型為url時,當type為url時生效
* url_param 展示類型為url時參數配置,當type為url時生效
*
* //樣式相關
* 'style' => '',
*
* // 字段前后附加內容
* 'prepend_content' => '', // 向前追加
* 'append_content' => '', // 向后追加
* 'bottom_html' => '', // 換行追加
當type為btn時,參數1(字段信息)為按鈕配置信息,多個按鈕以英文逗號分割,格式為
> ‘預定義按鈕類型.URL別名|數據參數1+數據參數2,預定義按鈕類型’
### 一、換行內容設置
~~~
['title', '試卷',[
'bottom_html'=>'作答時間{{$expected_duration}}分鐘,卷面總分{{$project_total_score}}分,題目{{$topic_num}}道'
]],
~~~

### 二、可選項/鍵值數組關聯
#### ① 讀取配置
~~~
//狀態 (config.php中配置項)
'status' => [
'1' => '啟用',
'0' => '禁用',
],
~~~
~~~
->setColumns([
['status.select', '狀態',['func'=>'c_name','config_name'=>'status'] ],
])
~~~
#### ② 鍵值數組
~~~
$organization_ids_name = [
10001=>'組織A',
10002=>'組織B',
];
~~~
~~~
->setColumns([
['organization_id', '所屬組織',['listdata'=>$organization_ids_name]],
])
~~~
#### ③ 多維數組
- 序言
- 環境搭建
- 下載及安裝
- 構建器
- 構建器概述
- 模版構建器(TBuilder)
- Tab組件
- Topbar組件
- 按鈕
- 頂部按鈕配置
- 按鈕配置明細
- 表格(table)
- Table案例
- 「方法」加載數據
- 「方法」設置數據列
- 「方法」列排序
- 「組件」檢索過濾器
- 「組件」頂部按鈕
- 「組件」列表按鈕
- 「配置」列快速編輯
- 「配置」列附加內容
- 「配置」顯隱列表復選框
- 「配置」自定義樣式
- 表單(form)
- Form案例
- 「方法」添加組件(addWidgets)
- 「方法」數據檢索過濾(filter)
- 「組件」富文本編輯器(kindeditor|editormd)
- 「組件」圖片組件(images|cropper)
- 「組件」select listbox組件(listbox)
- 「組件」顏色選擇器(button_color)
- 「組件」自定義內容
- 「配置」顯隱字段關聯(open_by)
- 「配置」form布局(layoutView)
- 「配置」隱藏描述區(hideWidgetsDesc)
- 「配置」數據驗證(validate)
- 「配置」隱藏表單底部按鈕(hideFormButton)
- 「配置」字段tip提示(tip)
- 自定義頁面(custom)
- Custom案例
- 「組件」echart
- 「組件」Tile Widgets
- 「配置」custom布局
- 「配置」自定義html內容
- 「配置」自定義提醒頁面
- 樹形(tree)
- Tree案例
- 左側菜單區配置
- 關閉左側菜單(hideLeftMenu)
- 頂部按鈕配置
- 自定義菜單配置
- 展現方式配置
- 表內增刪改(Tabullet)
- 通用設置
- 依賴文件加載(插件/js/css)
- 指定布局/模版
- 內容定位欄(setTrayMenu)
- 設置內容區側欄
- 模態框打開頁面
- 組件構建器(TWidget)
- echarts
- table
- form組件
- Tabs組件
- builder構建
- titleLine
- 數據構建器(DBuilder)
- 概述(案例)
- 「方法」獲取單條記錄詳情
- 「方法」獲取分頁列表數據
- 「方法」排序
- 「方法」設置查詢字段
- 「方法」快速編輯
- 「方法」數據導出
- 「方法」聯表查詢
- 「方法」查詢數據再處理
- 「配置」回調處理
- 「配置」設置過濾字段
- 「配置」指定過濾字段匹配值
- 「配置」增加編輯支持
- 「配置」查詢出全部數據
- 輔助類
- Excle
- 模塊開發
- 插件開發
- 擴展
- 行為擴展
- 行為日志
- 雜項
- 圖片異步加載
- jquery插件zeroModal
- 提示
- form表單驗證
- ajax相關
- 展開收起
- 常用函數
- 其他插件
- DEMO
- 增刪改查
- 安全
- XSS 攻擊
- 注入攻擊
- CSRF 攻擊
- 其他攻擊和漏洞
- 開發
- TBuilder組件開發
- 更新日志
- 關于文檔