How to use the table.edit.enabled function in table

To help you get started, we’ve selected a few table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github silentbalanceyh / vertx-ui / src / economy / backup / TreeTable / op / Op.Dynamic.ts View on Github external
const calcTable = (reference, table) => {
    // 驱动最大的level
    const counterContainer = {};
    const {operations = {}} = reference.state;
    // 是否启用编辑模式
    const options = Init.readOptions(reference);
    const isEdit = options["table.edit.enabled"];
    table.columns.forEach(column => {
        // 包含列的渲染处理
        column.render = (text, record) => {
            const currentRowSpan = record[`${column.level}._counter`];
            const rowKey = record[`${column.level}.key`];
            const checkKey = `${column.dataIndex}-${rowKey}`;
            if (counterContainer[checkKey]) {
                // 解决空行问题
                return text ? {
                    children: text,
                    props: {
                        rowSpan: 0
                    }
                } : {
                    children: text,
                    props: {
github silentbalanceyh / vertx-ui / src / economy / backup / TreeTable / op / Op.Data.ts View on Github external
const initData = (reference: any, data: any = []) => {
    // 计算Level
    data.forEach(item => Ux.treeCounter(item, 1));
    // 追加counter
    const flatted = Ux.treeFlat(data);
    // 每一行追加一个key防止rowKey问题
    flatted.forEach(each => each.key = Ux.randomUUID());
    // 编辑模式才会在空数据中增加
    const options = Init.readOptions(reference);
    if (options["table.edit.enabled"]) {
        if (0 === flatted.length) {
            // 最少有一行的前提就是table.empty.init = true
            if (options['table.empty.init']) {
                flatted.push(initRow(reference));
            }
        }
    }
    // 针对flatted的内容执行拉平处理
    return flatted;
};
export default {