[CLOSED] REST store sync callback

  1. #1

    [CLOSED] REST store sync callback

    Last edited by Daniil; Nov 13, 2012 at 10:14 AM. Reason: [CLOSED]
  2. #2
    Hi @thesvr,

    Welcome to the Ext.NET forums!

    Currently, a sync method returns undefined. "!undefined" gets true in JavaScript. Therefore you see "test2" every time.

    I tested a callback. It works well for me. Please clarify can't you see a "test1" message at all?

    Quote Originally Posted by thesvr View Post
    The REST proxy response is:
    {
        "valid": true,
        "message": "Saved"
    }
    Now in Ext.NET 2 and ExtJS 4, a response must contain saved records. Please look at this example.
    https://examples2.ext.net/#/GridPanel/Update/AutoSave/
  3. #3
    Indeed I don't get a "test 1" alert.

    I looked at the example, to me it looks like it just handles exeptions and no success.

    I also implemented the callback in the example using:

                            <Click Handler="#{Store1}.sync({
                            callback: function(records, operation, success) {
                                alert('test');
                                    }
                                }
                            );" />
    In modified the example I also don't get an alert.
  4. #4
    The issue with callback was fixed in 2.1 version
    I suggest to update from 2.1 branch and retest
  5. #5
    Quote Originally Posted by Vladimir View Post
    The issue with callback was fixed in 2.1 version
    I suggest to update from 2.1 branch and retest
    Hi it works for me using 2.1 branch and the function bellow. However I run into some other issues using the 2.1 branch. That makes me wonder if the 2.1 branch is suitable for a production environment?

            var savestore = function (store) {
    
                var g = store.getNewRecords(), d = store.getUpdatedRecords(), a = store.getRemovedRecords();
                if (g.length > 0 || d.length > 0 || a.length > 0) {
                    store.sync({
                        callback: function (records, operation) {
                            alert('synced');
                        }
                    });
                }
                else {
                    alert('nothing to sync');
                }
            }
  6. #6
    Yes, branch 2.1 is quite stable and will be released soon
    Can you describe the issues? We will be glad to fix it asap
  7. #7
    Quote Originally Posted by Vladimir View Post
    Yes, branch 2.1 is quite stable and will be released soon
    Can you describe the issues? We will be glad to fix it asap
    Okay I expected this answer so I am working on the migration to 2.1. Here are the issues I am currently working on:

    1. Model datetime format
    Using Ext.net 2.0 i used M$ as dateformat in my model for date field. In 2.1 are these send back as "\date\" format. This resulted in difficulties to process at the webservice.
    Using
    yyyy-MM-dd\\THH:mm:ss
    as dateformat solved the issue. Looks like: http://forums.ext.net/showthread.php...c-Date-Problem

    During the debugging I saw the advantages of ISO 8601. It offers an ability to eliminate timezone issues by using an UTC time in the format 2011-01-01T00:00:00.0000000Z (
    .ToString("O")
    ). For now I could not find an easy way to configure the model to use this format (especially the conversion to UTC).

    2. Partial view is not completely destroyed
    I have got a partial view in a tabpanel. When closing the tab the content is not destroyed when using
    Ext.Net.RenderMode.RenderTo
    during it's creation. However when using
    Ext.Net.RenderMode.Auto
    it works.

    3. RESTProxy, JSONreader /writer and root setting
    I have trouble reading and writing JSON when setting Root property in a REST proxy. When I removed the data level in store and JSON it works. When removing the data layer in JSON it looks as-well. So it looks like if the Root setting is ignored.

    My store simplified:
    .Store(store => store.Add(Html.X().Store()
    	.PageSize(100)
    	.ID("testStore")
    	.Proxy(proxy => proxy.Add(
    		Html.X().RestProxy()                                    
    			.Url(Url.Action("API", "api"))
    
    	))
    	.Reader(reader =>
    			Html.X().JsonReader()
    			.IDProperty("row_id")
    			.Root("data")   
    			.SuccessProperty("success")
    			.MessageProperty("message")
    	)
    	.Model(model => model.Add(Html.X().Model()
    		.Fields(fields =>
    				{
    
    					fields.Add(Html.X().ModelField().Name("test"));
    
    
    				})
    			))
    ))
  8. #8
    Quote Originally Posted by thesvr View Post
    Okay I expected this answer so I am working on the migration to 2.1. Here are the issues I am currently working on:

    1. Model datetime format
    Using Ext.net 2.0 i used M$ as dateformat in my model for date field. In 2.1 are these send back as "\date\" format. This resulted in difficulties to process at the webservice.
    Using
    yyyy-MM-dd\\THH:mm:ss
    as dateformat solved the issue. Looks like: http://forums.ext.net/showthread.php...c-Date-Problem

    During the debugging I saw the advantages of ISO 8601. It offers an ability to eliminate timezone issues by using an UTC time in the format 2011-01-01T00:00:00.0000000Z (
    .ToString("O")
    ). For now I could not find an easy way to configure the model to use this format (especially the conversion to UTC).
    There are a ModelField's DateWriteFormat and a Write's DateFormat options.
    http://docs.sencha.com/ext-js/4-1/#!...ateWriteFormat
    http://docs.sencha.com/ext-js/4-1/#!...cfg-dateFormat

    We think they could help.

    Quote Originally Posted by thesvr View Post
    2. Partial view is not completely destroyed
    I have got a partial view in a tabpanel. When closing the tab the content is not destroyed when using
    Ext.Net.RenderMode.RenderTo
    during it's creation. However when using
    Ext.Net.RenderMode.Auto
    it works.

    3. RESTProxy, JSONreader /writer and root setting
    I have trouble reading and writing JSON when setting Root property in a REST proxy. When I removed the data level in store and JSON it works. When removing the data layer in JSON it looks as-well. So it looks like if the Root setting is ignored.

    My store simplified:
    .Store(store => store.Add(Html.X().Store()
        .PageSize(100)
        .ID("testStore")
        .Proxy(proxy => proxy.Add(
            Html.X().RestProxy()                                    
                .Url(Url.Action("API", "api"))
    
        ))
        .Reader(reader =>
                Html.X().JsonReader()
                .IDProperty("row_id")
                .Root("data")   
                .SuccessProperty("success")
                .MessageProperty("message")
        )
        .Model(model => model.Add(Html.X().Model()
            .Fields(fields =>
                    {
    
                        fields.Add(Html.X().ModelField().Name("test"));
    
    
                    })
                ))
    ))
    Could you, please, start new forums threads with samples to reproduce? We will appreciate.

Similar Threads

  1. [CLOSED] Store Sync Date Problem
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 27, 2012, 1:40 PM
  2. [CLOSED] Store Callback not firing
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 21, 2012, 11:34 AM
  3. [CLOSED] ComboBox didn't sync store's change
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 12, 2012, 11:57 AM
  4. [CLOSED] [1.0] Store and REST
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Feb 28, 2010, 4:19 AM
  5. sync callback
    By gisxiaowei in forum 1.x Help
    Replies: 0
    Last Post: Aug 20, 2009, 11:50 AM

Tags for this Thread

Posting Permissions