通过服务器的引导表(wenzhixin)表分页不起作用

我正在尝试使用库(bootstrap-table.com)创建一个表以使用服务器分页。我正在使用以下示例:https://examples.bootstrap-table.com/index.html#options/table-ajax.html#view-source

我的后端代码如下:

<div class="table-responsive">
    <table 
    id="pedidos"
  data-toggle="table"
 data-data-type="text"
  data-url="<?php echo $url;?>/sistema/tabela_pedidos.php"
  data-side-pagination="server"
  data-pagination="true"
    >
<thead>
    <tr>
      <th data-field="pedido_data" >DATA</th>
      <th data-field="cliente_nome" >CLIENTE</th>
      <th data-field="produto_nome" >PRODUTO</th>
      <th data-field="produto_quantidade" >QUANT</th>
      <th data-field="cliente_src" >SRC</th>
      <th data-field="cliente_utm_source" >UTM_SOURCE</th>
      <th data-field="produto_preco" >PRECO</th>
      <th data-field="pagamento_tipo" >TIPO DE PAGAMENTO</th>
      <th data-field="pedido_status"  >STATUS</th>

    </tr>
  </thead>   </table></div> <!-- table -->

我服务器的答案是这样的:

{"total":1,"totalNotFiltered":1,"rows":[{"pedido_data":"teste","cliente_nome":"teste","produto_nome":"teste","produto_quantidade":"teste","cliente_src":"teste","cliente_utm_source":"teste","produto_preco":"teste","pagamento_tipo":"teste","pedido_status":"teste"}]}

网站(有效)的示例答案是:

{
  "total": 800,"totalNotFiltered": 800,"rows": [
    {
      "id": 0,"name": "Item 0","price": "$0"
    },{
      "id": 1,"name": "Item 1","price": "$1"
    },{
      "id": 2,"name": "Item 2","price": "$2"
    },{
      "id": 3,"name": "Item 3","price": "$3"
    }
  ]
}

我看到json格式是相同的,但是我的代码无法正常工作..

我的服务器代码如下:

<?php 

$dados = Array();
$dados['total'] = 1;
$dados['totalNotFiltered'] = 1;
$dados['rows'][] = Array('pedido_data'=>'teste','cliente_nome'=>'teste','produto_nome'=>'teste','produto_quantidade'=>'teste','cliente_src'=>'teste','cliente_utm_source'=>'teste','produto_preco'=>'teste','pagamento_tipo'=>'teste','pedido_status'=>'teste');

echo json_encode($dados,JSON_UnesCAPED_UNICODE);

mysqli_close($conecta);
?>
l635513504 回答:通过服务器的引导表(wenzhixin)表分页不起作用

只是尝试过并获得解决方案,也许是晚了,但希望对我这样的人有所帮助。

            $dados = Array();
            $dados['total'] = 10;
            $dados['totalNotFiltered'] = 2;
            $dados['rows'] = array(
                    Array(
                            "id"=> 0,"name"=> "Item 0","price"=> "$0"
                    ),Array(
                            "id"=> 1,"name"=> "Item 1","price"=> "$1"
                    )
            );

            echo json_encode($dados,JSON_UNESCAPED_UNICODE);

我认为问题出在您声明的变量中,

本文链接:https://www.f2er.com/3097626.html

大家都在问