Author Topic: Merge Data from two Remote Sources  (Read 2139 times)

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Merge Data from two Remote Sources
« on: November 17, 2017, 09:07:36 pm »
I'm sorry I'm about to ask a really lazy question...

The data for my grid is coming from two remote sources, each providing data in json suitable for dataModel.data.  The first source populates the left side of my grid and the second source populates further detail on the right side of the grid.  The sources share a common data element which I use in the first column.

Do you have any method in your grid functions which automatically merges two json sources that share a common data element such as "id", or must I loop through each row, finding a match then merging using something like .extend?

Many thanks.  Again, sorry for asking such a lazy question  :-[

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Merge Data from two Remote Sources
« Reply #1 on: November 17, 2017, 10:20:00 pm »
There is no such method in the grid, you might have to do it manually.

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Merge Data from two Remote Sources
« Reply #2 on: November 20, 2017, 12:33:31 am »
Ok, I thought so.  Thanks for your time.

Your 'search' method was actually really helpful though, so I'm using that as I step through each entry from the second remote source.

   
Code: [Select]
var searchRow = grid.search({ row: {partnumber: sdPartnumber}, first: true });
Many thanks.

Tony