Login to Website

Login dengan Facebook

 

Post Reply
Thread Tools
  #1  
Old 20th November 2011
Permenkaret
Ceriwiser
 
Join Date: Nov 2011
Posts: 351
Rep Power: 14
Permenkaret mempunyai hidup yang Normal
Default [extJS] Masukkin data JSON ke grid

agan" sekalian..

saya mau masukin JSON ini (hasil query dari SQL Server 2005) ke grid..



ini JSONnya


Code:

{"totalCount":11,"items":[{"username":"Henok","tanggalMasuk":"2011-06-12 00:00:00.0","staus":"On Progress","email":"[email protected]","namaTerlapor":"Roger","formID":"EMAIL-1","lokasi":"Jawa Barat","attachment":"-"},{"username":"Anuz","tanggalMasuk":"2011-06-14 00:00:00.0","staus":"On Progress","email":"[email protected]","namaTerlapor":"Agus","formID":"EMAIL-2","lokasi":"Jakarta","attachment":"-"},{"username":"Henok","tanggalMasuk":"2011-06-18 00:00:00.0","staus":"Masuk","email":"[email protected]","namaTerlapor":"Cathy","formID":"EMAIL-3","lokasi":"Jawa Barat","attachment":"-"},{"username":"Anuz","tanggalMasuk":"2011-06-14 00:00:00.0","staus":"Selesai","email":"[email protected]","namaTerlapor":"Hexy","formID":"LGSG-1","lokasi":"Jakarta","attachment":"-"},{"username":"Henok","tanggalMasuk":"2011-06-15 00:00:00.0","staus":"Masuk","email":"[email protected]","namaTerlapor":"Sandy","formID":"LGSG-2","lokasi":"Jawa Barat","attachment":"-"},{"username":"Henok","tanggalMasuk":"2011-06-23 13:15:50.7","staus":"Masuk","email":"[email protected]","namaTerlapor":"Tester","formID":"TEST-1","lokasi":"Jawa Timur","attachment":"-"},{"username":"Anuz","tanggalMasuk":"2011-06-10 00:00:00.0","staus":"On Progress","email":"[email protected]","namaTerlapor":"Ivan","formID":"WEB-1","lokasi":"Jawa Barat","attachment":"-"},{"username":"Henok","tanggalMasuk":"2011-06-22 00:00:00.0","staus":"Selesai","email":"[email protected]","namaTerlapor":"Prabu","formID":"WEB-2","lokasi":"Jakarta","attachment":"-"},{"username":"Anuz","tanggalMasuk":"2011-06-22 00:00:00.0","staus":"Selesai","email":"[email protected]","namaTerlapor":"Rendra","formID":"WEB-3","lokasi":"Jawa Barat","attachment":"-"},{"username":"Anuz","tanggalMasuk":"2011-06-22 00:00:00.0","staus":"Masuk","email":"[email protected]","namaTerlapor":"Sandy","formID":"WEB-4","lokasi":"Jawa Barat","attachment":"-"},{"username":"Henok","tanggalMasuk":"2011-06-23 00:00:00.0","staus":"Masuk","email":"[email protected]","namaTerlapor":"Melinda","formID":"WEB-5","lokasi":"Jawa Timur","attachment":"-"}]}

bikin JSONProxy, JSONReader, Store, dkk-nya buat masukin ke Grid gimana ya?



soalnya saya udah coba, tapi gak berhasil, loading melulu..

code saya sekarang:




Code:

Ext.define('showAll',
{
extend: 'Ext.data.Model',
fields: ['formID', 'tanggalMasuk', 'username', 'email', 'lokasi', 'namaTerlapor', 'status', 'attachment']
});

var proxyShowAll = new Ext.data.HttpProxy({url:'dbcon.jsp'});

var readerShowAll = new Ext.data.JsonReader(
{
type:'json',
root:'items',
totalProperty:'totalCount'
},[{
name: 'formID',
mapping: 'formID'
},{
name: 'tanggalMasuk',
mapping: 'tanggalMasuk'
},{
name: 'username',
mapping: 'username'
},{
name: 'email',
mapping: 'email'
},{
name: 'lokasi',
mapping: 'lokasi'
},{
name: 'namaTerlapor',
mapping: 'namaTerlapor'
},{
name: 'status',
mapping: 'status'
},{
name: 'attachment',
mapping: 'attachment'
}]
);

var storeShowAll = new Ext.data.Store({
proxy: proxyShowAll,
autoLoad: {params:{choice:'select'}},
model: 'showAll',
reader: readerShowAll
});

Thanks before ya



Sponsored Links
Space available
Post Reply




Switch to Mobile Mode

no new posts