开发者

JqGrid & Adobe AIR : Grid doesn't show up

开发者 https://www.devze.com 2023-02-08 14:13 出处:网络
I\'m developping an Adobe AIR application which gathers data (from intranet webservices) and stores it in AIR\'s SQLite database. I want to display this data using jqGrid, but the grid doesn\'t show u

I'm developping an Adobe AIR application which gathers data (from intranet webservices) and stores it in AIR's SQLite database. I want to display this data using jqGrid, but the grid doesn't show up.

At the moment i'm using local data since I don't have access to the webservices yet. I created dummy records in the DB just to be able to make the GUI. The data recovery from the database works perfectly fine, but when i want to add rows to the grid, i get a "false" answer for every row. Here's my code :

$('#result-table').jqGrid({
    datatype: 'clientSide',
    colNames:['Id','Date', 'Code Projet','Login Utilis开发者_JS百科ateur'],
    colModel :[ 
    {name:'id',index:'id', width:55, sorttype:'int'}, 
    {name:'str_date',index:'str_date', width:90, sorttype:'date', datefmt:'dd/mm/yyyy'}, 
    {name:'code_projet',index:'code_projet', width:80, align:'right',sorttype:'text'}, 
    {name:'user_login',index:'user_login', width:80, align:'right',sorttype:'text'}],
    caption: 'Résultats de la recherche'
}); 

for(i=0;i<liste.data.length;i++)
{
    var p = liste.data[i];

    var date = new Date();
    date.setTime(p.date);
    var str_date = date.getDate()+'/'+date.getMonth()+'/'+date.getFullYear();
    var row = {id:p.id, date:str_date, codeprojet: p.code_projet, userlogin:p.user_login};
    var result = $('#result-table').addRowData(p.id, p);
}

liste represents the return of the DB. All the data is stored in liste.data. If you have any questions regarding the rest of the code,or need an explanation about this one, just comment this post, i'll edit it asap.

Thanks for help.

Regards from France ;)


I think you meant to write:

var result = $('#result-table').addRowData(p.id, row);

Also, for what its worth, some of your column names in the JavaScript object do not match up with the names in the colmodel:

  • You said str_date in the colmodel but date in the object
  • You declared user_login in the colmodel but say userlogin in the object
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号