future-architect/cheetah-grid

How can I have each row perform different merge cell logic?

doubleKGe opened this issue · 3 comments

hello, I have a statistical row in my table, and I don't want it to merge cells, so what do I need to do?

I have solved my problem

I used to combine all the data into a single line to achieve different merge logic for different lines, but I found that this would have performance issues - there was no way to do local rendering (because there was only one line), so was it possible to implement different rendering logic for each row or group? I want to be able to merge the relevant parts of the cells into a function, passing in the number of the group to be rendered, so that dynamic rendering logic can be used, or passing in a list, so that each group can be merged with a different logic.

For example

body: [
    // Group1
    [
        // line1
        [
            { field: "personid", rowSpan: 2 },
            { field: "fname" },
            { field: "email", rowSpan: 2 },
            { field: "date", rowSpan: 2 },
        ],
        // line2
        [{ field: "lname" }]
    ],
    // Group2
    [
        // line1
        [
            { field: "personid" },
            { field: "name", rowSpan: 2 },
            { field: "email" },
            { field: "date" }
        ],
        // line2
        [
            { field: "personid" },
            { field: "email" },
            { field: "date" }
        ]
    ],
    ...
]

Thank you for posting this issue.
The current cheetah-grid does not have the ability to change the layout for each row of the body.
Maybe it's possible to use themes as in #62 to make it look like that virtually.
If that doesn't work, you may need to create your own grid component by extending cheetahGrid.core.DrawGrid.