[CLOSED] store set value and originalValue. rejectChanges doesn't work.

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] store set value and originalValue. rejectChanges doesn't work.

    alert(App.storeBirimler.getRecordsValues()[0].birim_adi) //test
    App.storeBirimler.data.items[0].raw.birim_adi = 'dededda';
    alert(App.storeBirimler.getRecordsValues()[0].birim_adi) //dededda
    records = App.storeBirimler.getUpdatedRecords();
    len = records.length;
    alert(len); //return 0
    App.storeBirimler.rejectChanges();
    App.storeBirimler.sync();
    doesn't give an error.
    doesn't work.
    Last edited by geoffrey.mcgill; Feb 18, 2015 at 5:28 PM. Reason: [CLOSED]
  2. #2
    Hello, siyahgul!

    I can't make that code run here in my side so I am going to share some thoughts from what I can infer from reading you lines. This might not be too useful.

    It seems you are changing the values directly in the store, so you kind of override the reversible system by adding data directly on the store, thus you can't revert the process, as you've already done the destructive operations directly.

    But to better understand and reproduce your problem, I suggest you provide us with a running, minimal test case.
    As least to where to start (if you don't have a better starting point yet), I could point you to this example: GridPanel with RowEditor Plugin, which is a grid row editor where you can cancel the changes on that given row before you save it.

    Another useful sample with another approach would be thisone: local paging in the GridPanel. Notice that, if you press the refresh button before saving, the data will not be submitted and any changes will be discarded.

    There are also other samples in the examples explorer showing how to save on SQL server, reload that saved data or reload without saving (which discards changes).

    If still in doubt how to build a working sample for us to reproduce your issue here, please refer to these two posts:
    - Forum Guidelines For Posting New Topics
    - More information required

    Sorry if I could not help much, I'm looking forward for your working sample so I can do you a better service.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I'm preparing a sample projects and video for you.
  4. #4
    Hello @siyahgul,

    Please try to replace
    App.storeBirimler.data.items[0].raw.birim_adi
    with
    App.storeBirimler.getAt(0).set("birim_adi", "test");
  5. #5
    I know you can with the set command, but it does not help me. Please wait for the video and sample project.
    Last edited by siyahgul; Feb 17, 2015 at 5:04 PM.
  6. #6
    ready.

    Video link: https://www.youtube.com/watch?v=fx3GNIsqpbA
    sample project link: EDIT: [REMOVED]

    EDIT: Please post all code samples directly in the forums within [CODE] tags.
    Last edited by geoffrey.mcgill; Feb 18, 2015 at 5:25 AM.
  7. #7
    Thank you.

    Binder.js is a two-way DOM-based databinding. In my best understanding, you bind data to the TreePanel directly via DOM objects bypassing its TreeStore. It is why the bound data is lost on sorting. On sorting the data comes from the TreePanel's TreeStore again, but it has no idea of what you bound to the DOM objects.

    As for expanding nodes. At the initial load the children of non-expanded nodes are just not rendered (no DOM objects), it is why there is no data on expand. TreePanel renders new nodes, but nobody binds data to them. Yes, you have fixed it re-binding the data on the AfterLayout event, though... our best recommendation is to avoid such the design as soon as possible.

    Ext.NET/ExtJS and Binder.js don't know about and don't support each other.

    Using the Ext.NET/ExtJS data package you are supposed to use its API. It is the only way to expect and get all the functionality working. Moreover, as for Binder.js, on its GitHub page I can see DEPRECATED - DON'T USE! Personally, I would really prefer not to use anything with such a label:) I am afraid that all is beyond our support.

    P.S. Somewhere we have already asked you to keep one issue per thread. Please follow it. In the video you are talking about 5-6 (?) issues. If a thread is about a few issues, it quickly gets very difficult to follow and maintain the thread. So, in this thread let's talk only about binding data to a TreePanel via Binder.js.
    Last edited by geoffrey.mcgill; Feb 18, 2015 at 5:20 AM.
  8. #8
    Hello siyahgul,

    Unfortunately the video you posted was impossible to following.

    As well, we will not open unsolicited .rar or .zip packages. Please do not link to them within the forums.

    If you cannot provide a simplified code sample directly in a forums post within [CODE] demonstrating the scenario, we will not be able to provide assistance.

    This will be a good time to remind you again of the Forum Guidelines. Please review all the guidelines and accept before posting in the forums again.

    http://forums.ext.net/showthread.php...ation-Required
    Geoffrey McGill
    Founder
  9. #9
    I paid you $ 3,000. You do not offer me a solution to the two-way binding process. I question Is there a two-way binding: You say he does not support. I'm using Binder.js alternative and you can not help anyway. I do not care with what to do. I want a two-way binding. A very simple request. I hope you understand me. good work.
  10. #10
    First of all, thank you for choosing Ext.NET!

    Second, I think my initial answer about two-way data binding was not ideal. I said it is not presented in Ext.NET v2. But I meant two-way DOM-based data binding and it is AngularJS or Binder.js that you try to use with Ext.NET.

    What is a two-way data binding? I like this answer:
    Two-way binding just means that:


    1. When properties in the model get updated, so does the UI.
    2. When UI elements get updated, the changes get propagated back to the model.
    So, I believe the two-way data binding is supported in Ext.NET v2.

    1. You update the Store (data layer) the TreePanel (UI) layer is being updated as well.
    2. You updated the TreePanel (UI layer), for example, editing a node's text, the data is Store is being updated.

    I would like to demonstrate it with an example that proves that the two statements above work in Ext.NET v2.

    Example
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button 
                runat="server" 
                Text="Get a node's text" 
                Handler="alert(App.TreePanel1.getStore().getNodeById('Node1').get('text'));" />
    
            <ext:Button 
                runat="server" 
                Text="Set a node's text" 
                Handler="App.TreePanel1.getStore().getNodeById('Node1').set('text', 'New Text');" />
    
            <ext:TreePanel ID="TreePanel1" runat="server">
                <Root>
                    <ext:Node Text="Root" Expanded="true">
                        <Children>
                            <ext:Node NodeID="Node1" Text="Node 1" Leaf="true" />
                            <ext:Node NodeID="Node2" Text="Node 2" Leaf="true" />
                        </Children>
                    </ext:Node>
                </Root>
                <Editor>
                    <ext:TextField runat="server" />
                </Editor>
                <Plugins>
                    <ext:CellEditing runat="server" />
                </Plugins>
            </ext:TreePanel>
        </form>
    </body>
    </html>
    So, I believe that Ext.NET 2 can be stated as supporting two-way data binding. Moreover, it is very essential part of Ext.NET and underlying ExtJS. Many people (including me) prefer and like Ext.NET/ExtJS specifically because of its data package.

    The two-way data binding functionality has been significantly improved in ExtJS 5 and, therefore, in Ext.NET 3. For example, see:
    https://examples3.ext.net/#/Data_Binding/Basic/Two_Way
    https://examples3.ext.net/#/Data_Bin...o_Way_Formulas

    Please look at the other examples as well (all the examples in the Data Binding folder).

    But a direct DOM-based two-way binding is not quite presented in Ext.NET and ExtJS. I should say that is not quite supposed to. ExtJS/Ext.NET applications are not supposed to deal with raw HTML markup a lot. Certainly, HTML might be used here and there. In some cases, there is the only way to use HTML. But the major philosophy is all about OOP and using Ext.NET and ExtJS Components. I am afraid that without following this philosophy it might be problematic to use Ext.NET and ExtJS.

    Anyways, we are here to help, but, I am afraid, we cannot add anymore regarding using Binder.js.
    Last edited by Daniil; Feb 18, 2015 at 11:22 AM.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Dec 08, 2014, 2:31 PM
  2. Replies: 5
    Last Post: Dec 13, 2012, 8:27 AM
  3. Replies: 2
    Last Post: Mar 15, 2012, 12:57 AM
  4. About Store.rejectChanges method
    By sunny_sh in forum 1.x Help
    Replies: 2
    Last Post: Aug 09, 2009, 11:43 PM
  5. Replies: 7
    Last Post: Apr 15, 2009, 11:44 AM

Posting Permissions