PDA

View Full Version : multiple widgets 1 datastore



PatrickS
30 Aug 2010, 5:09 AM
Hi,

I have a complex data type that I return from the server in json. In my form I want to have multiple widgets that use the same datastore/fetched data. Is there any example that shows how I can build a complex form that uses 1 dataset? For example, a form, with 2 tabs that each have a grid in it working on the same datastore.

Patrick

PatrickS
30 Aug 2010, 5:41 AM
To make it a little more explicit, this is the json datastructure I get back.

For the ArticleFeatures, Loads and Prices I need seperate grids to alter them. For the main information as ArticleID, AlsternativeName I need A form.

hope someone can help me out.


{
"type": "rpc",
"tid": 8,
"action": "Article",
"method": "GetDetails",
"result": {
"success": true,
"data": {
"ArticleID": 1784,
"AlternativeName": "Sinningia Avanti gemengd",
"FPLastPart": "11111",
"ProductID": 99999,
"CompanyKey": "XXXXXXXXXXXXXXXXXXXX",
"AddToCatalog": false,
"ProductAdditionalInfo": "Kleuren: rood - roze/wit - wit en paars",
"AddedValue": false,
"VisibleOnWebsite": true,
"HasLabel": false,
"HasWrap": true,
"Meerkarrenaantal1": 5,
"PrijskortingMeerkarrenaantal1": 0.0500,
"Meerkarrentaantal2": 10,
"PrijskortingMeerkarrenaantal2": 0.0000,
"Prijstoeslag1Laag": 0.0500,
"PrijstoeslagStapeldoos": 0.0200,
"OriginalPlantenID": 6363,
"Grower": {
"SalesmanID": "XXXXXXXXXXXXXXXXXXXXX",
"FPFirstPart": "100",
"Name": "XXXXXXXXXXXXX",
"SortName": "XXXXXXXXXXXXX",
"MainLocationKey": "XXXXXXXXXXXXXXXXX",
"PrimaryTelephoneNumber": "XXXXXXXXXXXXXX",
"SecondaryTelephoneNumber": "XXXXXXXXXXXXXXXXXX",
"FaxNumber": "XXXXXXXXXXXXXXX",
"EmailAddress": "XXXXXXXXXXXXXXXXX",
"LabelPricePot": 0.0500,
"LabelPriceWrap": 0.0300,
"LabelPricePrinted": 0.0100,
"BTWNumber": "XXXXXXXXXXXXXXXXXXX",
"Certifications": "AAAAA",
"FlorecomEnabled": false,
"TransporterName": "XXXXXXXXXXXXXX",
"TransporterTelephoneNumber": "-------------",
"OriginalKwekerID": 999,
"CompanyKey": "XXXXXXXXXXXXXXXXXXX",
"GrowerContacts": [],
"Articles": []
},
"ArticleFeatures": [{
"ArticleID": 1784,
"FeatureTypeID": "S01",
"FeatureValue": "012"
},
{
"ArticleID": 1784,
"FeatureTypeID": "S02",
"FeatureValue": "020"
},
{
"ArticleID": 1784,
"FeatureTypeID": "S36",
"FeatureValue": "030"
},
{
"ArticleID": 1784,
"FeatureTypeID": "S50",
"FeatureValue": "051"
}],
"ArticleLoads": [{
"ArticleLoadID": 1710,
"ArticleID": 1784,
"PackagingCode": 236,
"LayersPerContainer": 7,
"UnitsPerLayer": 6,
"PlantsPerUnit": 6,
"LoadCarrierID": 1
},
{
"ArticleLoadID": 2530,
"ArticleID": 1784,
"PackagingCode": 406,
"LayersPerContainer": 7,
"UnitsPerLayer": 5,
"PlantsPerUnit": 6,
"LoadCarrierID": 1
},
{
"ArticleLoadID": 4015,
"ArticleID": 1784,
"PackagingCode": 874,
"LayersPerContainer": 1,
"UnitsPerLayer": 2,
"PlantsPerUnit": 6,
"LoadCarrierID": 2
}],
"ArticlePrices": [{
"ArticleID": 1784,
"WeekNumber": 1,
"Available": false
},
{
"ArticleID": 1784,
"WeekNumber": 2,
"Available": false
},
{
"ArticleID": 1784,
"WeekNumber": 3,
"Available": false
},
{
"ArticleID": 1784,
"WeekNumber": 4,
"Available": false
}
<SNIP>]
}
}
}

steffenk
30 Aug 2010, 8:00 AM
you can do following:

load 1 store with the data, then make something like

store2.loadData(store1.reader.jsonData);

i often use such with different arrays in json where i feed several stores with result of one request.

PatrickS
30 Aug 2010, 8:03 AM
Do I still have the CRUD formbinding functionality?

steffenk
30 Aug 2010, 8:06 AM
of course not.