Parse hidden dataview

Hi!
i am trying to use 2 kind of showing data:
grid and dataview.I use s combo to select which of the two to choose.
when one of those is shown the other disappears.I also use a textbox to search the data.
The problem is when i make a search the shown element(grid) is filtered(parsed with the corresponding data), but the hidden element(dataview) is not parsed with the data.
The question is :How can i get or set the data of a hidden element?

{type:“clean”,

         cols:[
          {view:"combo",id:"sid",name:"sid", label:"View As", yCount:"2",align:"center",options:viewtypes},
          {view:"text",id:"lid",name:"lid", labelWidth:30, label:"<img id='imgsettings', height='29', style=\"padding-top:2px;\" src=\"resources/images/tabbar/settings.png\">", align:"right",popup:"tes" },
          {view:"combo",id:"filter",name:"filter", label:"Filter", yCount:"3",align:"center",options:filter},
          // { view:"imagebutton", id:"imgsettings", name:"imgsettings", align:"right",src:"resources/images/tabbar/settings.png",popup:"tes"}
          ]
    },

{cols:[
{view:“dataview”,id:“test”,width:widthdiv,type:{template:"#title#Status: #status# Owner: #smownerid#Customer: #accountid#Product: #prod_id#",height:80},select:true, data:vals},
{view:“grid”,id:“mygrid”, scroll:true,fields: arrfieldsgrid,datatype:“json”, data:vals}
]
}…

$$(“test”).hide();
$$(“mygrid”).show();
$$(“sid”).attachEvent(“onChange”,function(oldvalue,value){
if(oldvalue==‘dataview’){
viewdata=true;
viewgrid=false;
$$(“test”).show();
$$(“mygrid”).hide();
}

else {
    viewgrid=true;
    viewdata=false;
   $$("test").hide();
    $$("mygrid").show();

}

});


function afterCall(text,xml){
var datax = dhx.DataDriver.json.toObject(text,xml);
$$(“mygrid”).clearAll();
$$(“mygrid”).parse(datax);
$$(“test”).clearAll();
$$(“test”).parse(datax);
}

So i clear and parse the hidden dataview but when i click to show it, it contains the old datasource.
Please help me!
Thanks in advance.

If you need to have in dataview the same data as in grid, you can use once during init

$$(“test”).sync($$(“mygrid”).data);

after that dataview will reflect dataset of grid ( if grid will be filtered - dataview will show filtered set as well )

Hi!
Thank you for your suggestion but after i applied the code i didn’t get what i wanted.
The dataview doesn’t reflect the data of the grid.I don’t even get an error.
I added the code ($$("test").sync($$("mygrid").data);)
inside the dhx.ui and even inside the method where i refresh the grid.
I can say that when i click inspect element(in crome) the dataview shows the new datasource.
It seems strange.
I don’t know where is the problem , but i have my doubt on the facts:
Dataview is hidden and it doesn’t “obey” to the sync
Or , the fact that i don’t use the method $$(“mygrid”).filter(); but i use clearAll() and then parse the new datasource.

Thank you.

Hi,

Stanislav’s solution works great. The following will work too:

$$(“test”).sync($$(“mygrid”));

I have attached the ready sample
grid.zip (186 KB)

Hi !
Thanks for your help!
I tried the example you gave me, it works great.

I adapted it in my project,
but i think the problem was on the fact that i was trying to do server side
search (using clearAll and parse again) and the solution you gave me works on client side(filter).

Thanks again,
If you could give me any advice on filtering grid (and also dataview) on server side I would be grateful.