define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'send/message/title/index', table: 'send_title', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id'),operate: false}, {field: 'title', title: __('Title')}, ] ] }); $('.btn-add-title-list').on('click',function () { var ids = Table.api.selectedids(table); if(ids.length ==0 || ids.length>1){ Layer.alert('只能选择一项'); return false; } var title = $(document).find('.selected').children('td')[2].innerHTML; //ids = Table.api.getrowdata(table,ss); $(parent.document).find('#c-title').val(title); Fast.api.close(); }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });