Author Topic: Problem when quit a dialog  (Read 3470 times)

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Problem when quit a dialog
« on: September 10, 2014, 04:21:28 pm »
Hi team,

I set a dialog on my pggird cell. And I have function to did some logic when user quit an edit model. And each time I invoke this method by following way:

Code: [Select]
$("#grid_json").pqGrid({
        cellSave: function( event, ui ) {
            cellCalculate(ui,"SAVE", 0); 
        }
});
The "cellCalculate" is my customized method.

And for the dialog, I met a problem, I double click on my cell then the dialog will open, there will be some value in it, I choose some value and click "Add" button to invoke my function on "Add" button, like the following,

Code: [Select]
$("#div_dialog").dialog({ width: 600,height:500,resizable:false,modal: true,title: "Choose Accessory",
            buttons: {
                Add: function () {
                    var resStr="";
                    var resIdStr="";
                    var accChooseName = $("#chooseAccName").val();
                    var accChooseId = $("#chooseAccId").val();
                    resStr += accChooseName;
                    resIdStr += accChooseId;
                                   
                    $(this).dialog("close");
                    setAccessory(resIdStr,resStr);
                },
                Cancel: function () {
                    $(this).dialog("close");

                    $("#grid_json").pqGrid("quitEditMode");
                }
            },
            open: function () { $(".div_dialog").position({ of: "#div_dialog" }); },
            autoOpen: false,
            close: function(event, ui) {$("#grid_json").pqGrid("quitEditMode");}
        });


So when I click Add, I will go to "setAccessory(resIdStr,resStr)" function. I will handle the value in this method.

Code: [Select]
function setAccessory(idStr, valStr){

        accessoryRowData.accessories = valStr;
        accessoryRowData.accessoryId = idStr;
        accessoryRowData.isEdit = 'edit';

        $("#grid_json").pqGrid( "refreshColumn", {dataIndx :'accessories'} );
        $("#grid_json").pqGrid( "refreshColumn", {dataIndx :'accessoryId'} );
        $("#grid_json").pqGrid( "refreshColumn", {dataIndx :'isEdit'} );
        $("#grid_json").pqGrid("quitEditMode");
    }

Now when these steps finished, the pggird can't go to my "cellSave" and invoke my "cellCalculate" method.

So do you know why this happened?
I wanted is when the dialog closed I can enter the "cellSave" behavior.

Thank you!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Problem when quit a dialog
« Reply #1 on: September 10, 2014, 11:21:03 pm »
cellSave event is fired only when the cell value changes due to inline editing.

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: Problem when quit a dialog
« Reply #2 on: September 11, 2014, 06:55:22 am »
cellSave event is fired only when the cell value changes due to inline editing.

Got it. I think I need to find another way to solved this problem.

Thank you!