jQWidgets Forums

jQuery UI Widgets Forums Grid Nested Grid Addrow Problem

This topic contains 2 replies, has 2 voices, and was last updated by  Martin 6 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Nested Grid Addrow Problem #102586

    processmakeruser
    Participant

    Hi!

    I can’t add row in sub grid.

    I hope you can help me!

    Best Regards

    My code here

    function GRID_INITIALIZE_TEST(data) {
        var source = {
            datafields: [{
                    name: 'TEDARIKCI',
                    type: 'string'
                }, {
                    name: 'FATURA_NO',
                    type: 'string'
                },
                {
                    name: 'FATURA_TURU',
                    type: 'string'
                },
                {
                    name: 'FATURA_BEDELI',
                    type: 'float'
                },
                {
                    name: 'PARA_BIRIMI',
                    type: 'string'
                },
                {
                    name: 'FATURA_KESIM_TARIHI',
                    type: 'date'
                },
                {
                    name: 'FATURA_SON_ODEME_TARIHI',
                    type: 'date'
                },
                {
                    name: 'FATURA_DURUMU',
                    type: 'bool'
                },
                {
                    name: 'ACIKLAMA',
                    type: 'string'
                }
    
            ],
    
            datatype: 'json',
            localdata: data
        };
        var ONAY = ["Türk Lirası", "Dolar", "Euro"];
        var FATURA_TURU = ["Proforma Fatura", "İade Fatura", "e-Fatura", "Normal"];
        var adapter = new $.jqx.dataAdapter(source);
        // create nested grid.
        var initrowdetails = function (index, parentElement, gridElement, record) {
            var id = record.uid.toString();
    
            var URUN_GRID = $($(parentElement).children()[0]);
    
            console.log(URUN_GRID);
            var nestedSource = {
    
                datafields: [{
                        name: 'URUNKODU',
                        type: 'string'
                    },
                    {
                        name: 'FIYAT',
                        type: 'string'
                    },
                    {
                        name: 'BIRIM',
                        type: 'string'
                    },
                    {
                        name: 'MIKTAR',
                        type: 'integer'
                    },
                    {
                        name: 'PARABIRIMI',
                        type: 'string'
                    },
                    {
                        name: 'TOPLAM_TUTAR',
                        type: 'string'
                    }
    
                ],
                datatype: 'json',
                root: 'URUNLER',
                localdata: data[index].URUN_DATA
            };
    
            var nestedAdapter = new $.jqx.dataAdapter(nestedSource);
            if (URUN_GRID != null) {
                URUN_GRID.jqxGrid({
                    source: nestedAdapter,
                    theme: 'office',
                    altrows: true,
                    width: '95%',
                    autoheight: true,
                    sortable: true,
                    localization: getLocalization(),
                    editable: true,
                    columns: [{
                            text: "Ürün Kodu",
                            datafield: 'URUNKODU',
                            width: 250,
                            editable: false
                        },
                        {
                            text: "Miktar",
                            datafield: 'MIKTAR',
                            editable: false
                        },
                        {
                            text: "Birim",
                            datafield: 'BIRIM',
    
                            editable: false
                        },
                        {
                            text: "Fiyat",
                            datafield: 'FIYAT',
                            editable: false
                        },
                        {
                            text: "Para Birimi",
                            datafield: 'PARABIRIMI',
                            editable: false
                        },
                        {
                            text: "Toplam Tutar",
                            datafield: 'TOPLAM_TUTAR',
                            editable: false
                        }
                    ],
                    showtoolbar: false
                });
            }
    
        }
        var FATURA_DURUMU = ["Normal", "Onaya Gönder"];
        $("#DogrudanHizmetUrun").jqxGrid({
            width: '100%',
            source: source,
            theme: 'office',
            rowdetails: true,
            rowsheight: 30,
            sortable: true,
            localization: getLocalization(),
            initrowdetails: initrowdetails,
            showstatusbar: true,
            editable: true,
            statusbarheight: 25,
            showaggregates: true,
            altrows: true,
            rowdetailstemplate: {
                rowdetails: "<div id='URUN_GRID' style='margin: 10px; width: 100%; height:100%;'></div>",
                rowdetailsheight: 200,
                rowdetailshidden: true
            },
            columns: [{
                    text: "Tedarikçi",
                    datafield: 'TEDARIKCI',
    
                    editable: false,
                    pinned: true
                },
                {
                    text: "Fatura No",
                    datafield: 'FATURA_NO',
                    editable: true
                },
                {
                    text: "Fatura Türü",
                    datafield: 'FATURA_TURU',
                    columntype: 'combobox',
                    editable: true,
                    cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
                        if (value == "") {
                            return "<div style='padding-top: 7px; padding-left: 2px;' class='jqx-left-align'>Lütfen Seçiniz:</div>";
                        } else {
                            return "<div style='padding-top: 7px; padding-left: 2px;' class='jqx-left-align'>" + value + "</div>";
                        }
                    },
                    createeditor: function (row, column, editor) {
                        editor.jqxComboBox({
                            autoDropDownHeight: true,
                            source: FATURA_TURU,
                            promptText: "Lütfen Seçiniz:"
                        });
                    }
                },
                {
                    text: "Fatura Bedeli",
                    datafield: 'FATURA_BEDELI',
                    editable: true,
                    columntype: 'numberinput',
                    createeditor: function (row, cellValue, editor, cellText, width, height) {
                        editor.jqxNumberInput({
                            decimalDigits: 2,
                            decimalSeparator: ","
                        });
                    }
                },
                {
                    text: "Para Birimi",
                    datafield: 'PARA_BIRIMI',
                    editable: true,
                    columntype: 'combobox',
                    cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
                        if (value == "") {
                            return "<div style='padding-top: 7px; padding-left: 2px;' class='jqx-left-align'>Lütfen Seçiniz:</div>";
                        } else {
                            return "<div style='padding-top: 7px; padding-left: 2px;' class='jqx-left-align'>" + value + "</div>";
                        }
                    },
                    createeditor: function (row, column, editor) {
                        editor.jqxComboBox({
                            autoDropDownHeight: true,
                            source: ONAY,
                            promptText: "Lütfen Seçiniz:"
                        });
                    }
                },
                {
                    text: "Fatura Kesim Tarihi",
                    datafield: 'FATURA_KESIM_TARIHI',
                    cellsformat: 'dd.MM.yyyy',
                    columntype: 'datetimeinput',
                    width: 120,
                    editable: true
    
                },
                {
                    text: "Fatura Son Ödeme Tarihi",
                    datafield: 'FATURA_SON_ODEME_TARIHI',
                    columntype: 'datetimeinput',
                    cellsformat: 'dd.MM.yyyy',
                    width: 150,
                    editable: true
    
                },
                {
                    text: "Onaya Gönder",
                    datafield: 'FATURA_DURUMU',
                    columntype: 'checkbox',
                    editable: true,
                    width: 100,
                },
                {
                    text: "Açıklama",
                    datafield: 'ACIKLAMA',
                    width: 250,
                    editable: true
    
                },
            ],
    
        });
    
    }
    Nested Grid Addrow Problem #102587

    processmakeruser
    Participant

    and addition my adding code:

    $("#Ekle").click(function () {
        $("#DogrudanHizmetUrun").jqxGrid('addrow', null,{});
     
    });
    Nested Grid Addrow Problem #102602

    Martin
    Participant

    Hello processmakeruser,

    I would suggest you to see the approach for adding a new row in a nested grid
    in the following Example.

    Best Regards,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.