Results 1 to 6 of 6

Thread: Strange problem with MVVM association!

  1. #1
    Sencha User
    Join Date
    Jul 2016
    Posts
    18
    Answers
    2

    Default Strange problem with MVVM association!

    Hi Forum.
    I have a fiddle sample in here. it's a MVVM sample with one-to-many association between two entity.
    basically one "Recipient" could have none or several "BankAccount".
    I Bind two grid. I expect when I choose a "Recipient" un right it show me it's "BankAccount" in left.
    But it show all "BankAccount" in for every "Recipient" as you could see and somehow override "recipeintId" in "BankAccount" store!
    I straggling with it for 2 days but cant figure it what's my mistake about it.
    Could you please check it?

    Regards

  2. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    The problem is that your bank accounts json is static. When it asks to load from the server, it will send the recipientId to the server, it's expecting you to only return the accounts that have that id.

  3. #3
    Sencha Premium Member
    Join Date
    Dec 2012
    Location
    Seattle, WA
    Posts
    423
    Answers
    34

    Default

    Another way of doing this is to return the bank account data nested with the recipient...one less server call. Here is a sample fiddle https://fiddle.sencha.com/#fiddle/1ek7

  4. #4
    Sencha User
    Join Date
    Jul 2016
    Posts
    18
    Answers
    2

    Default

    Thank you guys!

    Actually I tried nested data loading before and it have some unexpected behavior too! it display correct data for every "Recipient" that have "Bank Account" but for a "Recipient" that have No "Bank Account" it go for a server request again and show all!

    I find it today that I was hitting by a bug in Ext JS 6.0.1.250! when I select Ext JS 6.0.2.437 in fiddle it do the right thing (No "Bank Account" for Recipient id:5).
    I edit mock data in fiddle so you can see it here.

    Also about loading data from server I have some fog in my mine about how do that in right way.
    I have web api 2 in server side. when I select a "Recipient" I have a request like this for get it's "Bank Account".
    Code:
    https://localhost/Payments/api/BankAccounts?_dc=1470489766904&filter=[{"property":"recipientId","value":4,"exactMatch":true}]
    I don't know how to consume it in server side. Is there any way to route it to a controller action like "/Recipients/4/BankAccounts" or I should do it with try to parse request and get property and value? ( it don't seem a proper way in my mind)

    Regards

  5. #5
    Sencha User
    Join Date
    Jul 2016
    Posts
    18
    Answers
    2

    Default

    I really need some advice about why ExtJs send request to server like what I show in last post

    Code:
    https://localhost/Payments/api/BankAccounts?_dc=1470489766904&filter=[{"property":"recipientId","value":4,"exactMatch":true}]
    and how I have it to send a REST request instead that is like /Recipients/4/BankAccounts

    any Idea?

  6. #6
    Sencha Premium Member
    Join Date
    Dec 2012
    Location
    Seattle, WA
    Posts
    423
    Answers
    34

    Default

    Out of the box the REST proxy can't do complex URLs so you will need to override the the buildUrl method. Have a look at this stack post http://stackoverflow.com/questions/1...es-with-ext-js

Similar Threads

  1. problem run MVVM sample on fiddle
    By omidi in forum Ext JS 6.x Q&A
    Replies: 3
    Last Post: 2 Aug 2016, 1:35 PM
  2. MVVM Grid Panel and Paging Toolbar store problem
    By deathgod86 in forum Ext JS 6.x Q&A
    Replies: 5
    Last Post: 27 Aug 2015, 6:53 AM
  3. Replies: 1
    Last Post: 13 Mar 2014, 6:20 AM
  4. Strange association problem
    By bozegovic in forum Ext:Bugs
    Replies: 2
    Last Post: 25 Sep 2013, 2:47 AM
  5. Association problem
    By sravankumar in forum Ext: Q&A
    Replies: 1
    Last Post: 14 May 2012, 5:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •