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的查询条件。

    基本上这样就差不多了。

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

  • 相关阅读:
    Exection throws和throw
    Exection(二)
    JAVA-Exception
    IDEA初见---输出HelloWorld,并打包成jar包
    Centos6.5安装Tomcat
    Centos6.5下装ZooKeeper
    LInux下装jdk
    python作业高级FTP
    tcp黏包
    计算器
  • 原文地址:https://www.cnblogs.com/stanzhu/p/3208153.html
Copyright © 2011-2022 走看看