VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-sheet/demo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-sheet/demo/test2.js
var _ = absol._;
var __ = o=> absol._(o).addTo(document.body);
var $ = absol.$;
window.data_module = {};

var exampleData = {
    exampleTitle: "Bảng ví dụ",
    config: {},
    propertyNames: ['text_column', 'number_column', 'enum_column', 'rand'],
    propertyDescriptors: {
        text_column: {
            type: "text",
            text: "Cột Văn Bản",
            required: true
        },
        number_column: {
            type: "number",
            text: "Cột Số",
            required: true
        },
        enum_column: {
            type: "enum",
            text: "Cột Enum",
            required: true,
            items: [
                { value: 1, text: "Giá trị 1" },
                { value: 2, text: "Giá trị 2" },
                { value: 3, text: "Giá trị 3" }
            ]
        },
        rand:{
            type: "number",
            calc: "= number_column * random()",
        }
    },
    records: [
        { text_column: "Dòng 1", number_column: 123 },
        { text_column: "Dòng 2", number_column: 456 },
        { text_column: "Dòng 3", number_column: 789 }
    ]
};
var fragment = new absol.Fragment();
_({
    tag: 'h3',
    child: { text: exampleData.exampleTitle }
}).addTo(document.body);

var context = {
    random: function (){
        return Math.floor(Math.random() * 1000);
    }
};

var editor = new absol.sheet.TableEditor(Object.assign({ fragment: fragment, context:context }, exampleData.config));
editor.on('change', function () {
    console.log(this.getData().records);
});
editor.getView().addClass("simple-table")
    .addStyle({
        width: 'auto'
    })
    .addTo(document.body);

editor.setData(absol.copyJSVariable(exampleData));


VaKeR 2022