var fields = [
    {
        fieldName: "KorName",
        dataType: "text",
    },
    {
        fieldName: "Gender",
        dataType: "text",
    },
    {
        fieldName: "BirthDay",
        dataType: "datetime",
        datetimeFormat: "yyyy-MM-dd",
    },
];

var btOptions1 = {
    startView: 0,
    minViewMode: 0,
    todayBtn: "linked",
    language: "kr",
    todayHighlight: true,
    language:"ko"
}

var columns = [
    {
        name: "KorName",
        fieldName: "KorName",
        width: "100",
        header: {
            text: "이름",
        },
    },
    {
        name: "BirthDay",
        fieldName: "BirthDay",
        width: "150",
        header: {
            text: "생일",
        },
        editor: {
            type:"btdate", 
            btOptions:btOptions1, //옵션 변수 설정
            datetimeFormat:"yyyy-MM-dd", 
            textReadOnly:true
        },    
        editButtonVisibility: "always",
    },
];

const data = [
    {
        KorName: "박영호",
        Gender: "남",
        BirthDay: "1996-10-31",
    },
    {
        KorName: "조일형",
        Gender: "남",
        BirthDay: "1995-03-26",
    },
    {
        KorName: "김덕중",
        Gender: "여",
        BirthDay: "1988-07-02",
    },
    {
        KorName: "국영석",
        Gender: "남",
        BirthDay: "2000-02-04",
    },
];

document.addEventListener("DOMContentLoaded", function () {
    RealGrid.setLicenseKey(
        "upVcPE+wPOmtLjqyBIh9RkM/nBOseBrflwxYpzGZyYm9cY8amGDkiMnVeQKUHJDjW2y71jtk+wteqHQ1mRMIXzEcGIrzZpzzNTakk0yR9UcKS69Wn2kI83Uszabo3mU0LUipz0P8BheMHilNXwOhKViPkoEUbYPLyVfdcZjXXt8="
    );

    const provider = new RealGrid.LocalDataProvider();
    const gridView = new RealGrid.GridView("realgridContainer");
    gridView.setDataSource(provider);

    provider.setFields(fields);
    gridView.setColumns(columns);

    provider.setRows(data);
});