forum

Home / DeveloperSection / Forums / How can we reload store and refresh grid on button click in following code?

How can we reload store and refresh grid on button click in following code?

Simond Gear129517-Feb-2017

How can we reload store and refresh grid on button click in following code?

updateClick: function (field, newValue, oldValue) {  //updateClick function call on update button click
        console.log(field);
        var me = this;
        var form = Ext.getCmp('userForm'); //get component of userForm and assign value into form variable
        var values = form.getValues(); //call getValue function by association of form variable and assign into values variable
        Ext.Ajax.request({     //send Ajax request to MVC controller request
            url: './User/Update',   //give path of method define in MVC controller
            method: 'POST',     //use POST method
            jsonData: values,   //send values in the form of jsonData
            success: function (response) {      //define success function
                var result = Ext.decode(response.responseText);
                if (result.success === true) {
                    Ext.Msg.show({
                        title: 'EMPLOYEE',
                        msg: result.message,
                        buttons: Ext.Msg.OK,
                        icon:Ext.MessageBox.INFORMATION
                    });
                }
                else {
                    Ext.Msg.show({
                        title: 'EMPLOYEE',
                        msg: result.message,
                        buttons: Ext.Msg.OK,
                        icon:Ext.MessageBox.ERROR
                    });
                }
            },
            failure: function () {  //define failure function on response of mvc controller
                Ext.Msg.show({
                    title: 'Record not Updated',
                    msg: result.message,
                    buttons: Ext.Msg.OK,
                    icon: Ext.MessageBox.ERROR
                });
            }
        });
    },

Updated on 17-Feb-2017

Can you answer this question?


Answer

1 Answers

Liked By