Question

I have a xPage with following content:

<xe:restService id="restService" preventDojoStore="false">
    <xe:this.service>
        <xe:viewJsonService viewName="vwChartData"
            contentType="text/json">
            <xe:this.columns>
                <xe:restViewColumn columnName="x" name="valuex"></xe:restViewColumn>
                <xe:restViewColumn columnName="y" name="valuey"></xe:restViewColumn>
            </xe:this.columns>
        </xe:viewJsonService>
    </xe:this.service>
</xe:restService>

How to fetch the data after page load? From what I understand it should create a Dojo store, although it never loads the data.

When I add to the page a xe:djxDataGrid, hide it from user, I can easily access the data from created Dojo Store, either by referring directly the restService variable, or through djxDataGrid.

Solution:

<xp:scriptBlock>
    <xp:this.value><![CDATA[XSP.addOnLoad( function() {
    var ds = eval('restService');
    ds.fetch({
        onComplete : function(items, request) {
            console.log(items);
        }
    });
});]]></xp:this.value>
</xp:scriptBlock>
Was it helpful?

Solution

When you look at the source code when using a data grid you would see all the source code necessary to link your Dojo store. Watch the XSP.onLoad for trigger code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top