PDA

View Full Version : [CLOSED] store set value and originalValue. rejectChanges doesn't work.



siyahgul
Feb 16, 2015, 12:53 PM
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.

fabricio.murta
Feb 16, 2015, 10:00 PM
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 (http://examples2.ext.net/#/GridPanel/Plugins/RowEditor/), 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 (http://examples2.ext.net/#/GridPanel/Paging_and_Sorting/Local_Data_Paging/). 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 (http://forums.ext.net/showthread.php?3440)
- More information required (http://forums.ext.net/showthread.php?10205)

Sorry if I could not help much, I'm looking forward for your working sample so I can do you a better service.

siyahgul
Feb 17, 2015, 11:44 AM
I'm preparing a sample projects and video for you.

Daniil
Feb 17, 2015, 11:55 AM
Hello @siyahgul,

Please try to replace


App.storeBirimler.data.items[0].raw.birim_adi
with


App.storeBirimler.getAt(0).set("birim_adi", "test");

siyahgul
Feb 17, 2015, 4:58 PM
I know you can with the set command, but it does not help me. Please wait for the video and sample project.

siyahgul
Feb 17, 2015, 7:22 PM
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.

Daniil
Feb 18, 2015, 4:53 AM
Thank you.

Binder.js (https://github.com/nekman/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 (https://github.com/nekman/binder.js) 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.

geoffrey.mcgill
Feb 18, 2015, 5:28 AM
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?10205-More-Information-Required

siyahgul
Feb 18, 2015, 9:51 AM
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.

Daniil
Feb 18, 2015, 11:16 AM
First of all, thank you for choosing Ext.NET!

Second, I think my initial answer about two-way data binding (http://forums.ext.net/showthread.php?53971-store-and-two-way-binding&p=249131&viewfull=1#post249131) 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 (http://stackoverflow.com/questions/13504906/what-is-two-way-binding/13504965#13504965):


Two-way binding just means that:



When properties in the model get updated, so does the UI.
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:
http://examples.ext.net/#/Data_Binding/Basic/Two_Way
http://examples.ext.net/#/Data_Binding/Basic/Two_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.

siyahgul
Feb 18, 2015, 11:57 AM
Two-way binding shorten your writing code process. I know how to write code is as the example. My license I 2.x. I switch 3.x if you give me $ 3,500. You are not advertising any future 3.x version. We will have 2 months instead of 2.x to 3.x different license. This is a university and educational institutions. If solves our problems you were going to tell our students Ext.net. You missed that chance. We found a solution. We want to return us to receive our ext.net 2.x license. Please this is thread close. thank you.

geoffrey.mcgill
Feb 18, 2015, 4:52 PM
Hello siyahgul,

If you have a licensing questions, please feel free to email your questions or comments to support@ext.net.

Daniil has provided a working sample using pure Ext JS. It would be nice to receive your feedback regarding that sample. If the sample does not meet your requirements, please let us know.

From what I'm reading, you are asking us to support Binder.js. When I view the Binder.js README, all I see is the following message:

http://forums.ext.net/attachment.php?attachmentid=21341&stc=1

The author of Binder.js is telling everyone to NOT use the library. Unfortunately we will not provide assistance for an external library where the author is clearly stating to not use.

I hope this helps answer some of your questions.

siyahgul
Feb 18, 2015, 5:23 PM
God forgive you. Let's not use binder.js. Write you. Do I need it, though you do? close please.

geoffrey.mcgill
Feb 18, 2015, 5:28 PM
God forgive you. Let's not use binder.js. Write you. Do I need it, though you do? close please.

Thread has been marked as [CLOSED].