refreshing data display in multiview Lists

I’m having trouble displaying new data in lists that are within a multiview. I am building a iphone application with phonegap.

The data is in json format and is created by extracting from a local sqlite db and building in a javascript variable. Some data is also being downloaded from a server where I have no control over the format and thus have to reformat it locally to get it to display in the lists.

I can get the data to load initially, when the app starts, however if the data changes or new data downloads, I cannot get the lists to update. The only method I have used successfully is to reload the view with another one that is the same but has a different name:

eg: dhx.ui(list2, $$(“approot”),“list”);

This does loads ok but the view now has a different name and thus instructions to the original view do not work against it.

The data flow is like so:

  1. json data down loads and is transformed and placed in to js variable
  2. call dhx.ui(list2, $$(“approot”),“list”); to display it.
  3. The relevant item in the list is clicked and this selection makes a call to the server and gets more json
  4. The new json is transformed and and placed in a JS variable eg var newlist =[{…]]
  5. the list newlist var data need to be loaded into another list. - have only achieved an updated view by using the dhx.ui method above.

So how do you:

A. make a list in a multiview update its content without having to use the dhx.ui method?
B. get the selection from one list to update the display of data in another another list?

Any help in this would be greatly appreciated

Sam

make a list in a multiview update its content without having to use the dhx.ui method?

you may reload list data:

$$(“listId”).clearAll();
$$(“listId”).load(url);

get the selection from one list to update the display of data in another another list?

You may use binding:

dhtmlxTouch_v10_111114/samples/technical/server/01_loading/05_list_list_client.html
dhtmlxTouch_v10_111114/samples/technical/server/01_loading/06_list_list_server.html

or you may set event handler

$$(‘list1’).attachEvent(“onItemClick”, function(id){
var data = this.item(id);

});

$$(‘listB’).load(json_ulr);

or

$$(‘listB’).parse(json_obj);

Check server/01_loading/06_list_list_server.html

$$('mylist2').define("dataFeed", "data.php"); //url for data loading $$('mylist2').bind($$('mylist1'), function(master, filter){ filter.name = master.name; //define data which will be sent to server side });

Hi there,

thanks for the suggestions I will try those out as well.

In the end I was able to load data into a multiview page using:

$$(“viewdata1”).parse(orgviewcombo3,“json”);

where:
“viewdata1” is the id of the container I want to load the data into
“myjsonobject” is the javascript variable with json string that I have reformatted entered into it.

This works most of the time, but I have found that trying to attach this data to using a event listener like this below doesn’t seem to work for me.

I have variables tabbar_1 assigned with the data. I’m expecting the pages to load this into the relevant “SubBar” that has simple templates with “id” holders to receive the data. This only works for me if I create a button and call a function with the code in to perform the refresh.

It might be xcode and phonegap. I’m having other problems there that I will post in a new topic.

Is there another way to exactly target the item you wan the data to go into?

Also if the code below goes in with other views eg nested multiview, even the classic function does not work. I saw in the scheduler documentation that it is made up of lots of different views and that you needed to put in a reference path to the view that you wanted to target. Is this the case here?

    $$("SubBar").attachEvent("onBeforeTabClick",function(button,id){
        get_Data(id);
        console.log("id="+id);
        $$(id).parse(id,"json");
        $$(id).show();
        return true
    })
 {
view:"toolbar",id:"SubBar",
 elements:[
{ view:"button", label: "update", align:'left' ,id:"tabbar_1", click:"update_view"},
  { view:"button", label: "update", align:'center' ,id:"tabbar_2", click:"update_view"},
{ view:"button", label: "update", align:'right' ,id:"tabbar_3", click:"update_view"}
]
},
{view:"multiview", gravity:2,
                                    cells:[
                                        { template:"1#type#<BR/>#from#<BR/>#to#<BR/>#depart#<BR/>#arrive#<BR/>#pnum#<BR/>#changes#<BR/>#hotels#<BR/>#hire#<BR/>1", id:"tabbar_1" },
                                        { template:"2#type#<BR/>#from#<BR/>#to#<BR/>#depart#<BR/>#arrive#<BR/>#pnum#<BR/>#changes#<BR/>#hotels#<BR/>#hire#<BR/>2", id:"tabbar_2" },
                                        { template:"3#type#<BR/>#from#<BR/>#to#<BR/>#depart#<BR/>#arrive#<BR/>#pnum#<BR/>#changes#<BR/>#hotels#<BR/>#hire#<BR/>3", id:"tabbar_3" }
                                    ]
                                }

Thanks

Sam