zoukankan      html  css  js  c++  java
  • 基于slick grid做infinite scroll(2)

    看来我这个标题得改一改了,

    基本上不需要我操作slick grid了,我们用了MAAS team的maas grid,

    他们对scroll的定义是virtual scroll with dynamic data set,

    我要做的是在data source plugin 中对数据的获取做配置。

     this.read = function (options, success) {
                        dataConfig.data(options).then(function (entityCollections) {
                            var result = {
                                items: [],
                                meta: {
                                    total: 0
                                }
                            };
    
                            angular.forEach(entityCollections, function (entityCollection) {
                                result.items = _.union(result.items, entityCollection.entities);
                                result.meta.total+=entityCollection.totalCount;
                            });
    
                            success(result);
                        });
                    };

    将options传入到dataConfig.data方法中,该options对应于data-source-svc的queryOptions.

    在tree-module-children-grid-controller的getChildrenWithEntityType中将startIndex:options.skip + 1添加到configuration中。

    skip的计算是为了保证view port 在page 中间,基本上=from -(pageSize/2-viewport/2),他的最小值是0,但是alm 的entities是从1开始计数,

    所以需要再加上1.

    在entity-factory里params['start-index'] =  configuration.startIndex;

    将start-index作为查询rest的查询条件。

    基本上这样就差不多了。

    赚工资很容易有没有,哈哈!

  • 相关阅读:
    Markdown示例
    初识Markdown
    Ubuntu源整理
    Vi编辑器入门
    Ubuntu,Linux入门系统
    [其他]volatile 关键字
    Qt5:随窗口大小变化背景图片自动缩放的实现
    Qt5:不规则按钮的实现---通过贴图实现
    windows编程:创建DLL
    [转]Firefox拦截12306订票网站的解决办法
  • 原文地址:https://www.cnblogs.com/stanzhu/p/3208153.html
Copyright © 2011-2022 走看看