Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] support multiple custom cellStyle #2841

Closed
purpose233 opened this issue Nov 15, 2024 · 0 comments · Fixed by #2889
Closed

[Feature] support multiple custom cellStyle #2841

purpose233 opened this issue Nov 15, 2024 · 0 comments · Fixed by #2889
Assignees
Labels
bp bp feature 新需求

Comments

@purpose233
Copy link

Version

1.10.0

Link to Minimal Reproduction

null

Steps to Reproduce

let  tableInstance;
  fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json')
    .then((res) => res.json())
    .then((data) => {

const columns =[
    {
        "field": "Order ID",
        "title": "Order ID",
        "width": "auto"
    },
    {
        "field": "Customer ID",
        "title": "Customer ID",
        "width": "auto"
    },
    {
        "field": "Product Name",
        "title": "Product Name",
        "width": "auto"
    },
    {
        "field": "Category",
        "title": "Category",
        "width": "auto"
    },
    {
        "field": "Sub-Category",
        "title": "Sub-Category",
        "width": "auto"
    },
    {
        "field": "Region",
        "title": "Region",
        "width": "auto"
    },
    {
        "field": "City",
        "title": "City",
        "width": "auto"
    },
    {
        "field": "Order Date",
        "title": "Order Date",
        "width": "auto"
    },
    {
        "field": "Quantity",
        "title": "Quantity",
        "width": "auto"
    },
    {
        "field": "Sales",
        "title": "Sales",
        "width": "auto"
    },
    {
        "field": "Profit",
        "title": "Profit",
        "width": "auto"
    }
];

const option = {
  records:data,
  columns,
  widthMode:'standard',
//   theme: {
//     bodyStyle: {
//         borderLineDash: [3,3]
//     }
//   }
};
tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID),option);
window['tableInstance'] = tableInstance;

const rowStyle = {
    key: 'customRow',
    row: 2,
    style: {
        bgColor: 'lightgreen',
    }
}
tableInstance.registerCustomCellStyle(rowStyle.key, rowStyle.style);
tableInstance.arrangeCustomCellStyle(
    {
        range: {
          start: {
            row: rowStyle.row,
            col: 0
          },
          end: {
            row: rowStyle.row,
            col: tableInstance.colCount - 1
          }
        }
    },
    rowStyle.key
);

const cellStyle = {
    key: 'customCell',
    row: 2,
    col: 2,
    style: {
        color: 'red'
    }
};

tableInstance.registerCustomCellStyle(cellStyle.key, cellStyle.style);
tableInstance.arrangeCustomCellStyle(
    {
        range: {
          start: {
            row: cellStyle.row,
            col: cellStyle.col
          },
          end: {
            row: cellStyle.row,
            col: cellStyle.col
          }
        }
    },
    cellStyle.key
);

    })

Current Behavior

For now, only one custom cell style will be apply to cell, even if multiple custom cell styles are registered.
image

Expected Behavior

Apply all registered custom cell styles to tables cell by the register order or priorities.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@purpose233 purpose233 added the bug Something isn't working label Nov 15, 2024
@fangsmile fangsmile added the bp bp label Nov 15, 2024
@Rui-Sun Rui-Sun added feature 新需求 and removed bug Something isn't working labels Nov 19, 2024
@Rui-Sun Rui-Sun changed the title [Bug] support multiple custom cellStyle [Feature] support multiple custom cellStyle Nov 19, 2024
@Rui-Sun Rui-Sun linked a pull request Nov 21, 2024 that will close this issue
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bp bp feature 新需求
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants