NG-网格服务器端分页 [英] ng-grid server side paging

查看:230
本文介绍了NG-网格服务器端分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对如何使用NG-电网断绝端分页有点困惑。 ( http://angular-ui.github.io/ng-grid/

I'm a little confused on how to use the sever side paging for ng-grid. (http://angular-ui.github.io/ng-grid/)

有人能指出我在如何实现这一目标服务器端朝着正确的方向?这个例子显示了一个静态的JSON文件。如何以及在哪里是限制设置和偏移,所以我可以调整我的SQL查询和输出parameteres。这似乎是所有加载的同时在表面上。

Can someone point me in the right direction on how to achieve this on the server side? The example shows a static json file. How and where are the parameteres set for limit and offset so I can adjust my sql query and output. It seems on the surface it is all loaded at once.

感谢。我知道这可能会下降,但票不得不采取的机会。

Thanks. I know this may get down votes but had to take the chance.

推荐答案

不知道这是否可以帮助你,因为我用的是SLIM架构路由和MEEKRO作为我的mysql服务器端famework。但它归结到这一点:

Not sure if this helps you because I use the SLIM Framework for routing and MEEKRO as mysql famework on my serverside. But it comes down to this:

这是我的 getPagedDataAsync 函数看起来像

    $scope.getPagedDataAsync = function (pageSize, page, sorting,searching) {
            $http.get('db_api.php/'+pageSize+'/'+page+'/'+sorting.sortfield+'/'+sorting.sortdir+'/'+searching).success(function (data) {
                    $scope.profiles = data.result;
                    $scope.totalServerItems = data.all;
                    $scope.filtered = data.filtered;
                    if (!$scope.$$phase) {
                            $scope.$apply();
                    }
            });
    };

它发送一个GET请求到我的PHP脚本与被观察者聚集的参数。不像例如这需要将 sortOptions 考虑。如果你不想在服务器端使用路由框架,你应该与通常的问号符号的符号替换斜杠。

It sends a GET request to my php script with the parameters that are gathered by the watchers. Unlike the example this takes also the sortOptions into account. If you don't want to use a routing framework on the server side you should replace the slashes with the usual questionmark ampersand notation.

通过看你的代表,我认为这应该已经给你一个线索。回来,如果你需要在SQL查询进一步的帮助。

By looking at your rep I think this should already give you a clue. Come back if you need further help on the sql query.

这篇关于NG-网格服务器端分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆