Pré -requisito: funções de pesquisa e paginação personalizadas, como a função de procurar nomes de produtos.
Fenômeno: Ao procurar bonecas infláveis, retornar 100 registros e recorrer à página 5. Nesse momento, procure por palitos de massagem, existem 200 dados e o resultado deve ser o registro na primeira página, mas a tela real é o resultado na quinta página. Ou seja, depois de pesquisar novamente, o Pagenumber não mudou.
De acordo com a maior parte do ditado on -line: apenas redefinir a opção
$ ('#tableList'). Bootstraptable ({PagenBumber: 1, PageSize: 10});O acima não pode resolver esse problema.
A maneira correta de fazer isso é
$ ("#tabela"). Bootstraptable ('Destroy'); a tabela deve ser destruída primeiro, caso contrário, o conteúdo carregado por último será retido
TableObj.otableInit (); Reinitize a tabela.
O código se parece com o seguinte:
<script type = "text/javascript"> $ (function () {tableObj.otableInit (); $ ("#BTN_QUERY"). Clique (function () {$ ("#tb_departments"). {$ .messager.alert ('TIP', 'Selecione o registro a ser excluído');}); $ ("#BTN_ADD"). Clique (function () {var actionurl = "@url.action (" _ create ")"; var param = {}; TableoTableInit: function () {$('#tb_departments').bootstrapTable({url: '/Department/GetDepartment', //Request the URL (*) method: 'get', //Request method (*) toolbar: '#toolbar', //Which container striped by the tool button is true, //Where to display the line interval color cache: false, //Whether to use cache, the default is true, so in general, you need to set this property (*) pagination: true, //Does the page display (*) sortable: false, //Does the sortOrder enable: "asc", //Sorting method//QueryParams: TableObj.queryParams(this), //Pass the parameters (*) queryParams: function (params) {return {PagedIndex: this.pagenumber, PagedSize: this.pagesize, deptName: $ ("#txt_search_departmentname"). pageList: [5, 10, 25, 50, 100], //Number of rows per page to select (*) search: false, // Whether to display table search, this search is a client search and will not enter the server, so I personally feel that it is meaningless strictSearch: true, showColumns: true, //Does all columns showRefresh: true, //Does the refresh button minimumCountColumns: 2, //The minimum number of colunas permitidas clicktosselect: true, // o clique para selecionar a altura da linha: 500, // altura da linha. false, //Does the detailed view detailView: false, //Does the parent and child table columns: [{//field: 'deptID',//field: 'deptID',checkbox: true},{field: 'DeptName',title: 'Department name'}, {field: 'CreateBy',title: 'Add person'}, {field: 'CreateDT',title: 'Add date',formatter: function (val) {retorna val == 'indefinido' ||!O exposto acima é a solução para a tabela de bootstrap paging e pesquisar o problema após a introdução da tabela de bootstrap. Espero que seja útil para você. Se você tiver alguma dúvida, deixe -me uma mensagem e o editor responderá a você a tempo. Muito obrigado pelo seu apoio ao site wulin.com!