jQuery UI Widgets Forums Grid Insert, update problem on master-detail table

This topic contains 3 replies, has 2 voices, and was last updated by  darkelf 9 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • darkelf
    Participant

    Hi;
    I using master-detail table on my project perfectly. But i have interested problem.
    I have a DataAdapter its contain insert and update method. (I used before other page without any problem like this.)
    And I use like this:

                           if (yeniOP==0) {
    //                            rowData["sozlesme_id"]= aktifSozlesme;
                                $("#odemePlaniGrid").jqxGrid('updateRow', aktifSozlesme, rowData);
                                console.log("OP update");
                            } else {
                                $("#odemePlaniGrid").jqxGrid('addRow', null, rowData,"");
                                console.log("OP insert");
                                opInitScreen();
                            }

    I saw OP insert or OP update on the console. But not triggered insert or update method my datasource.

    My datasource is:

        sozlesmeOPSource ={
            dataType: "json",
            datafields:
                [
                    { name: 'taksit_id', type: 'string' },
                    { name: 'sozlesme_id', type: 'string' },
                    { name: 'pOdemeTarih', type: 'date', format: "yyyy-MM-dd" },
                    { name: 'gOdemeTarih', type: 'date', format: "yyyy-MM-dd" },
                    { name: 'ucret', type: 'number' },
                    { name: 'birim', type: 'string' },
                    { name: 'asama', type: 'string' },
                    { name: 'notlar', type: 'string' }
                ],
            cache: false,
            id: 'taksit_id',
            url: 'sablon/modul/controllers/odemeplanlari.php?istek=oplistele',
            data: {
                sozlesme_id: aktifSozlesme
            },
            formatdata: function (data) {
                if (!data.sozlesme_id) data.sozlesme_id = aktifSozlesme;
                return data;
            },
            addRow: function (rowid, rowdata, position, commit) {
                // synchronize with the server - send insert command
                // alert("parentID: " + parentID + " rowID: " + rowID);
                var data = "istek=insert&" + $.param(rowdata) + "&sozlesme_id="+ aktifsozlesme;
                console.log("Add işlemi dataları: " + $.param(rowdata));
                $.ajax({
                    cache: false,
                    dataType: 'json',
                    url: "sablon/modul/controllers/odemeplanlari.php",
                    data: data,
                    type: "POST",
                    success: function (data, status, xhr) {
                        commit(true,data); //tell grid about the new id.
    
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        commit(false);
                    }
                });
            },
            updateRow: function(rowID, rowdata, commit) {
                // synchronize with the server - send update command
                // call commit with parameter true if the synchronization with the server is successful
                // and with parameter false if the synchronization failed.
                var dateFormat = "yyyy-MM-dd";
                rowdata.baslangic_tarihi= sozlesmeOPDataAdapter.formatDate(rowdata.baslangic_tarihi, dateFormat);
                rowdata.bitis_tarihi = sozlesmeOPDataAdapter.formatDate(rowdata.bitis_tarihi, dateFormat);
                var data = "istek=update&" + $.param(rowdata) + "&gorevid="+ aktifGorev;
                console.log("Update işlemi dataları: " + $.param(rowdata));
                $.ajax({
                    dataType: 'json',
                    url: 'sablon/modul/controllers/odemeplanlari.php',
                    data: data,
                    cache: false,
                    success: function (data, status, xhr) {
                        commit(true);
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        commit(false);
                    }
                });
            }
        };
    
        sozlesmeOPDataAdapter = new $.jqx.dataAdapter(sozlesmeOPSource, { autoBind: true });
    

    What is my problem? Could you help me plaease?
    Thanks.


    Dimitar
    Participant

    Hello darkelf,

    The callback functions are called updaterow and addrow, not updateRow and addRow. Please correct this and there should be no issues.

    Best Regards,
    Dimitar

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


    darkelf
    Participant

    Hi;
    Thanks for your answers. I changed to mistake but not work 🙁

    I’m looking for any idea 🙁
    Thanks.


    darkelf
    Participant

    Aha;
    I found my mistake…
    I used in the addrow
    var data = "istek=insert&" + $.param(rowdata) + "&sozlesme_id="+ aktifSozlesme;
    But i cant define to aktifSozlesme;
    Thanks…

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

You must be logged in to reply to this topic.