# grid with extra data fetcht from webservice [closed]

chillworld
5322 4 9
https://github.com/chillw...

Hi all,

I have a grid where I should go for each component to a webservice. I get an object back but I need to show that object 2 times in the grid. I don't want to fetch the stupid object twice cause I already got it and don't want to spoil network resource on that.

This is for the moment the grid :

<grid model="@load(vm.entries)" mold="paging" pageSize="@load(vm.pagingEntrySize)" pagingPosition="top" context="null" emptyMessage="No record retrieved">
<columns sizable="true" >
<column label="column1"/>
<column label="column2"/>
<column label="column3"/>
<column label="column4"/>
<column label="column5"/>
<column label="column6"/>
<column label="column7"/>
<column label="webserviceobject date" />
<column label="webserviceobject date2" />
</columns>
<template name="model" var="oe">
</row>
</template>
</grid>


I remove all the relevant data but the problem is here : I see in the logging that fx is being fetched once for each oe But the binded label with fx.date and fx.date2 are not giving something. I first set there this :

<label value="@load(fx eq null?'No info':fx.date)"/>


This always showed up No info. (in the logging from what I get from the webservice I clearly see that the dates are filled in so the object and the dates are not null)

So where is mine (stupid) fault? Row is the parent of the label so fx should be visible until the end tag. Or do someone have an other solution/thought pure in the zul? I know I can store a map in the vm, put oe as key and the object as value but that is just what I'm trying not to do (keep the vm simple and clean)

Greetz chill.

delete retag edit

### The question has been closed for the following reason "the question is answered, right answer was accepted"by chillworld close date 2015-03-26 16:48:55

Sort by » oldest newest most voted

RaymondChao
386 1 4

Hello,

due to the description, the @id syntax Target Attribute are viewModel, form and validationMessages.

<row value="@id('fx') @load(vm.getMedicalExamination(oe))">


to:

<row form="@id('fx') @init(vm.getMedicalExamination(oe))">


and try again. Thanks.

Nope, already tried that get compiler fault then.(In approx 3hr I can say what error :) ), but thx for the reply and that doc.

( 2014-04-02 03:50:05 +0800 )edit

Sorry, I used @init not @load in my sample code :( .

( 2014-04-02 04:14:48 +0800 )edit

I shall try with @init when I'm at work.

( 2014-04-02 04:18:03 +0800 )edit

By the way, why not using <row fx="@ref(vm.getMedicalExamination(oe))"> instead? Does it not fit your needs?

( 2014-04-02 05:04:16 +0800 )edit

because you just learned me that ;), I can do 2 like that in the row? like fx and fx2?

( 2014-04-02 05:06:44 +0800 )edit