0
votes

i am developing a Worklight application using DOJO which shows list data based on webservice response.For getting webservice response i have created an adapter,i tested the adapter and its working fine.My problem is to show this json data on another view ,also in the new view i taught of showing this data in a list(list should populate based on json data array length) so that if i click on a list it will show that details.

How to do this .Any help is appreciated.

Code.

.js

function dispData()
{
    var invocationData = {
            adapter : 'getSampleAdapter',
            procedure : 'sample'
        };

    WL.Client.invokeProcedure(invocationData,{
        onSuccess : Success,
        onFailure : Failure,
    });
}

function Success(result)
{
    var httpStatusCode = result.status;
    if (200 == httpStatusCode) {


        dijit.registry.byId("view0").performTransition("view1", 1, "slide");
    }
}

html file

<div data-dojo-type="dojox.mobile.ScrollableView" id="view0"
            data-dojo-props="selected:false,scrollDir:'v'">
        <div data-dojo-type="dojox.mobile.Heading"
            data-dojo-props="label:'Status'"></div>
            <button data-dojo-type="dojox.mobile.Button" style="margin-left: 38%; margin-top: 30%"
            data-dojo-props="label:'Data Details', onClick:function(e){dispData();}" ></button>
    </div>


<div data-dojo-type="dojox.mobile.ScrollableView" id="view1"
        data-dojo-props="selected:false,scrollDir:'v'">
        <div data-dojo-type="dojox.mobile.Heading"
            data-dojo-props="label:'Data'" back="Status" moveTo="view0"></div>

----------Json Data Should display here--------
</div>
1

1 Answers

0
votes

this is a technical forum. You must try to do it before you post this. However use dojox.mobile.EdgeToEdgeStoreList.Put a json response in a global variable such as

    var mydata="[ ";
mydata+="{ 'label': 'bla bla', 'moveTo':'#'  }, ";
mydata+="] ";
global_var= eval (mydata);
globalStoreList.generateList(global_var);

and build a list programmatly(example)