1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    61
    Answers
    3
    Vote Rating
    0
    azinyama is on a distinguished road

      0  

    Default Answered: Store Not Syncing With Return Result Data

    Answered: Store Not Syncing With Return Result Data


    Hi all!!!

    I'm having a problem with my Ext.Direct and my store. The store is not automatically syncing with the data that is being returned with the new id.

    Model:
    Code:
    Ext.define('ClaimCatch_RIS.model.Procedure',
    {
        extend: 'Ext.data.Model',
        
        fields  : 
        [
            {
                name: 'id', 
                type: 'int'
            },
            {
                name: 'Procedure_NAMAS', 
                type: 'string'
            },
            {
                name: 'Procedure_Name', 
                type: 'string'
            },
            {
                name: 'Procedure_Abbr', 
                type: 'string'
            },
            {
                name: 'Procedure_ClaimType', 
                type: 'string'
            },
            {
                name: 'Procedure_Code', 
                type: 'string'
            },
            {
                name: 'Procedure_Tag', 
                type: 'string'
            },
            {
                name: 'Procedure_Address', 
                type: 'string'
            },
            {
                name: 'Procedure_Email', 
                type: 'string'
            }
        ]
    });
    Store:
    Code:
    Ext.define('ClaimCatch_RIS.store.Procedure', 
    {
        extend          : 'Ext.data.Store',
        id              : 'Procedures',
        autoLoad        : false,
        autoSave        : false,
        autoSync        : true,
        remoteSort      : true,
        model           : 'ClaimCatch_RIS.model.Procedure', 
        proxy           : {
                            type        : 'direct',
                            reader      : {
                                            type            : 'json',
                                            successProperty : 'success',
                                            messageProperty : 'message',
                                            totalProperty   : 'total',
                                            root            : 'data',
                                            idProperty      : 'id'
                                        }, 
                            writer      : {
                                            type            : 'json',
                                            encode          : false,
                                            writeAllFields  : true
                                        }, 
                            api         : {
                                            create  : _ProcedureHandler.Create_Procedure,
                                            read    : _ProcedureHandler.Load_Procedure,
                                            update  : _ProcedureHandler.Update_Procedure,
                                            destroy : _ProcedureHandler.Delete_Procedure
                                        },
                            listeners   : {
                                            exception   : function(proxy, response, operation)
                                                        {
                                                            Ext.MessageBox.show(
                                                            {
                                                                title   : 'Remote Exception: Procedure',
                                                                msg     : operation.getError(),
                                                                icon    : Ext.MessageBox.ERROR,
                                                                buttons : Ext.Msg.OK
                                                            });
                                                        }
                                        },
                            afterRequest: function (request, success) 
                                        {
                                            if (request.action == 'read')
                                            {
                                                this.readCallback(request, success);
                                            }
                                            else if (request.action == 'create')
                                            {
                                                this.createCallback(request, success);
                                            }
                                            else if (request.action == 'update')
                                            {
                                                this.updateCallback(request, success);
                                            }
                                            else if (request.action == 'destroy')
                                            {
                                                this.deleteCallback(request, success);
                                            }
                                        },
                            readCallback: function (request, success) 
                                        {
                                            if (!request.operation.success) 
                                            {
                                                Ext.Msg.show(
                                                {
                                                    title   : 'Procedure Load Error',
                                                    msg     : request.operation.getError(),
                                                    buttons : Ext.Msg.OK,
                                                    icon    : Ext.Msg.WARNING
                                                });
                                            }
                                        },
                            createCallback: function (request, success) 
                                        {
                                            if (!request.operation.success && request.operation.hasException())
                                            {
                                                Ext.Msg.show(
                                                {
                                                    title   : 'Procedure Create Error',
                                                    msg     : request.operation.getError(),
                                                    buttons : Ext.MessageBox.OK,
                                                    icon    : Ext.MessageBox.ERROR
                                                });
                                            }
                                        },
                            updateCallback: function (request, success) 
                                        {
                                            if (!request.operation.success && request.operation.hasException())
                                            {
                                                Ext.Msg.show(
                                                {
                                                    title   : 'Procedure Update Error',
                                                    msg     : request.operation.getError(),
                                                    buttons : Ext.MessageBox.OK,
                                                    icon    : Ext.MessageBox.ERROR
                                                });
                                            }
                                            else
                                            {
                                            }
                                        },
                            deleteCallback: function (request, success) 
                                        {
                                            if (!request.operation.success && request.operation.hasException())
                                            {
                                                Ext.Msg.show(
                                                {
                                                    title   : 'Procedure Delete Error',
                                                    msg     : request.operation.getError(),
                                                    buttons : Ext.MessageBox.OK,
                                                    icon    : Ext.MessageBox.ERROR
                                                });
                                            }
                                        },
                            scope       : this
                        }
    });
    Direct Method
    Code:
    
        <DirectMethod()> _
        <ParseAsJson()> _
        Public Function Update_Procedure(ByVal o As JObject) As JObject
            Dim p As Procedure = Nothing
    
            Try
                p = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Procedure)(o.ToString())
                p.Procedure_Update()
            Catch ex As DirectException
                Return New JObject(New JProperty("success", False), New JProperty("message", ex.Message))
            End Try
    
            Return JObject.Parse(JsonConvert.SerializeObject(p))
        End Function
    The method returns id with a value from the database. This I have checked. But the id value is not being updated in the store. What am I doing wrong???

  2. Problem solved. The root being sent back by the json was 'result' and not 'data' as set in the store.

  3. #2
    Sencha User
    Join Date
    Oct 2011
    Posts
    61
    Answers
    3
    Vote Rating
    0
    azinyama is on a distinguished road

      0  

    Default


    Problem solved. The root being sent back by the json was 'result' and not 'data' as set in the store.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi