Git Product home page Git Product logo

Comments (9)

baukh789 avatar baukh789 commented on May 28, 2024

GridManager不支持重复渲染,所以不能通过一个表格实例化为三个表格。
我看了你所说的内容中有存在更改columnData的情况, 所以可以明确你所要的是三个不同的表格。
虽然GridManager不支持同一个table多次渲染,但是可以把公共的部分抽取出来。
如:

var tabel1 = document.querySelector('table1');
var tabel2 = document.querySelector('table2');
var tabel3 = document.querySelector('table3');
var commonSettings = {
     ....// 公共的配置
}
var table1Settings = {
    query: {customerStatus: 0},
    columnData:[]
}
var table2Settings = {
    query: {customerStatus: 2},
    columnData:[]
}
var table3Settings = {
    query: {customerStatus: 3},
    columnData:[]
}
table1.GM(Object.assign({}, tabl1Settings, commonSettings));
table2.GM(Object.assign({}, tabl2Settings, commonSettings));
table3.GM(Object.assign({}, tabl3Settings, commonSettings));

这种方式, 就会省去重复的代码。
不可重复渲染问题,是在设计时就确定不使用的。

我看到你下午所用到了setQuery, 这个方法主要是用于搜索功能的。而你所需要的是三个不同的表格,所以建议你用上面的方式,将公共的抽取来解决。

另外,谢谢你的支持,如果对GridManager感兴趣,可以star或fork之后来一同对该组件进行维护。

from gridmanager.

deepthan avatar deepthan commented on May 28, 2024

谢谢你的方法,这样可以省去很多冗余代码。我又遇到一个问题请教一下啊?还是上面那个表格,当我切换到不同的表格调用document.querySelector('#allInfoTable').GM('refreshGrid',false,{});这个方法刷新表格,当然每个表格的取不同的id吗,这时候就会出现传过去的cpage=0的情况,麻烦帮忙看一下 ,谢谢。

from gridmanager.

deepthan avatar deepthan commented on May 28, 2024

补充: 当两个表格互相切换的时候,若从有数据的表格切换到无数据的表格时候,无数据表格传递的参数是cpage=0,如果两个表格都有数据则正常。

from gridmanager.

baukh789 avatar baukh789 commented on May 28, 2024

refreshGrid 方法存在的BUG已经修复,请重新下载新版本。
十分感谢你所提供的BUG信息。

from gridmanager.

deepthan avatar deepthan commented on May 28, 2024

谢谢 神速啊 超赞 我马上下载试试

from gridmanager.

deepthan avatar deepthan commented on May 28, 2024

你好,我下载了2.3.11版本并替换了,但是还是不起作用,切换到其他表格的时候还是传递的

`{

pSize:10
cPage:0
tPage:0
tSize:0
}`,我试了setquery方法触发刷新还是一样。是不是我版本没下正确?

from gridmanager.

baukh789 avatar baukh789 commented on May 28, 2024

检查你的数据格式是否与Demo格式相同
检查是否返回了totals或者指定的匹配字段,
另建议你在切换tab所执行的refreshGrid方法中, gotoFristPage设置为true

from gridmanager.

deepthan avatar deepthan commented on May 28, 2024

数据格式是相同的。
返回了totals和指定的匹配字段,因为我让后端做了处理,我传cpage=0和传cpage=1效果一样。
gotoFristPage设置为true了。
但是还是有这个问题:
三个表格,切换到另外一个表格的时候触发refreshGrid方法,传递过去的参数是{pSize:10,
cPage:0,
tPage:0,
tSize:0
},
理应是{cpage=1,pSize:10}。我来拜读一下源码~

from gridmanager.

baukh789 avatar baukh789 commented on May 28, 2024

你先自已看下,实在解决不了,可以把完整的代码块粘在这里。

from gridmanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.