0

grid with extra data fetcht from webservice [closed]

asked 2014-04-01 07:51:37 +0800

chillworld gravatar image chillworld flag of Belgium
5307 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 value="@id('fx') @load(vm.getMedicalExamination(oe))">
            <label value="@load(oe.column1)"/>
            <label value="@load(oe.column2)"/>
            <label value="@load(oe.column3)"/>
            <label value="@load(oe.column4)"/>
            <label value="@load(vm.getcolumn5(oe))"/>
            <label value="@load(oe.column6)" />
            <label value="@load(oe.column7)" />
            <label value="@load(fx.date)"/>
            <label value="@load(fx.date2)"/>
        </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 flag offensive 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

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-04-02 03:39:12 +0800

RaymondChao gravatar image RaymondChao
386 1 4

updated 2014-04-02 04:17:17 +0800

Hello,

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

So please change

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

to:

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

and try again. Thanks.

link publish delete flag offensive edit

Comments

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

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

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

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

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

chillworld ( 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?

RaymondChao ( 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?

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

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-04-01 07:51:37 +0800

Seen: 13 times

Last updated: Apr 02 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More