在引导数据表中从服务器端加载数据

时间:2014-10-11 07:20:39

标签: php json angularjs twitter-bootstrap datatable

嗨,我是bootstrap和angularJS的新手。我正在尝试使用PHP从服务器端mysql加载数据到引导程序但是它花费了大量时间,因为有3000条记录并且记录首先加载然后它在Bootstrap数据表中显示超过5分钟。但我需要非常快。我也在使用AngularJS。 在谷歌搜索中,我发现我们可以通过处理服务器端的数据来实现。因此, 我需要知道如何在Bootstrap Data-Table中从服务器端填充数据。

请帮助我!!! :)

示例JSON数据:(我从我的PHP文件中获取)

  

get.php?json = all& query = SELECT * FROM student LIMIT 0,3


    [
       {
          "id":"1",
          "fname":"AARYA",
          "mname":null,
          "lname":"M",
          "gender":"MALE",
          "dob":"2004-10-04",
          "admissiondate":"2014-03-28 06:38:49",
          "academic_year":"2013-2014",
          "admissionnumber":"-",
          "class":"4",
          "section":"D",
          "rollno":"1",
          "applicationnumber":null,
          "mobile":"9655093949",
          "transporttype":"school-transport",
          "transportm":null,
          "pickuppoint":"ECHAMPATTI",
          "photo":"upload\/student\/1.jpg",
          "parentid":"1",
          "pickup":"125",
          "discountid":"1",
          "tf_discountid":"0",
          "bs_discountid":"0"
       },
       {
          "id":"2",
          "fname":"ABHI",
          "mname":null,
          "lname":"S",
          "gender":"MALE",
          "dob":"2004-06-13",
          "admissiondate":"2014-03-28 03:17:35",
          "academic_year":"2013-2014",
          "admissionnumber":"-",
          "class":"4",
          "section":"D",
          "rollno":"2",
          "applicationnumber":null,
          "mobile":"-",
          "transporttype":"own-transport",
          "transportm":null,
          "pickuppoint":"NA",
          "photo":"upload\/student\/2.jpg",
          "parentid":"2",
          "pickup":null,
          "discountid":null,
          "tf_discountid":"0",
          "bs_discountid":"0"
       },
       {
          "id":"3",
          "fname":"AHRAF",
          "mname":null,
          "lname":"A",
          "gender":"MALE",
          "dob":"2004-10-25",
          "admissiondate":"2014-03-28 03:17:35",
          "academic_year":"2013-2014",
          "admissionnumber":"-",
          "class":"4",
          "section":"D",
          "rollno":"3",
          "applicationnumber":null,
          "mobile":"9025509301",
          "transporttype":"school-transport",
          "transportm":null,
          "pickuppoint":"RAYAKOTTAI",
          "photo":"upload\/student\/3.jpg",
          "parentid":"3",
          "pickup":"1",
          "discountid":null,
          "tf_discountid":"0",
          "bs_discountid":"0"
       }
    ]

1 个答案:

答案 0 :(得分:1)

我在表格中使用ng-repeat来自服务器的数据。以下内容:

<table class="table table-striped">
    <tr ng-repeat="data in serverData">
        <td>{{data.fname}}</td>
        <td>{{data.lname}}</td>
    </tr>
</table>