Question

J'appelle un repos WebScript utilisant ExtJs avec JSON, mais impossible d'afficher sur la vue. Le problème est que je reçois les données JSON comme réponse du serveur.Mais lorsque je souhaite afficher sur la vue.Ils ne s'affiche pas.

Voici mon JSON:

{
"data":
{
    "ticket":"TICKET_87c91dd9d18d7242e44ff638df01e0cb388ee4c7"
}
}

et voici le code extjs:

Ext.onReady(function() {

alert("in login js");

var store = new Ext.data.JsonStore({
    proxy : new Ext.data.ScriptTagProxy({

        // url : 'http://ip:8080/alfresco/service/api/login',
        url : 'http://ip:8080/alfresco/service/api/login?u=Value1&pw=Value2&format=json',
        method : 'GET'


    }),

     reader : new Ext.data.JsonReader({ 
                root : 'data', 
                fields : ['ticket']
     })


});

alert("after the webscript call");
//store.load();
 var grid = new Ext.grid.GridPanel({
    renderTo: 'PagingFragment',
    frame:true,
    width:600,
    height:800,
    autoHeight: true,
    autoWidth: true,
    store: store,
    loadMask:true,
    columns: [
    {
        height:100,
        width:100,
        header: "Ticket",
        dataIndex: 'ticket',
       // renderer: title_img,
        //id: 'ticket',
        sortable: true
    }

    ],

    bbar: new Ext.PagingToolbar({
        pageSize: 2,
        store:store,
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}'

    }),
    sm: new Ext.grid.RowSelectionModel({
        singleSelect: true,
        listeners: {
            rowselect: {
                fn: function(sm,index,record) {
                    Ext.Msg.alert('You Selected',record.data.title);
                }
            }
        }
    })
});
store.load({
    params: {
        start: 0,
        limit: 5
    }
});

});

et dans JSP:

<body>
    <div id="PagingFragment" style="position:absolute;top:10px;left:200px">

    </div>


</body>

Quelqu'un pourrait-il aider sur cette

Était-ce utile?

La solution

'Data' doit être un tableau. Au lieu de {Data: {Ticket: 'blahablahblah'}} Vous devez revenir {Data: [{billet: 'blahablahblah'}]} Voir la différence?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top