PDA

View Full Version : Invalid label on load JSON data in ext gwt



aldi_farad
8 Mar 2012, 8:57 PM
Hello master,
I have a problem about loading Json data into my application using ScriptTaxProxy.I have develop application using ExtGWT2.2.5 in Java. This is my client simple codes:


String url = "http://xxx.xx.xx.xxx/myWs/index.php/jsonData";
ScriptTagProxy<ListLoadResult<ModelData>> proxy = new ScriptTagProxy<ListLoadResult<ModelData>>(url);

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("EQUIPTYPE", "Topic Title", 100)); columns.add(new ColumnConfig("EQUIPCODE", "Topic ID", 165));
columns.add(new ColumnConfig("TOTAL", "Author", 100));


ColumnModel cm = new ColumnModel(columns);

ModelType type = new ModelType();
type.setRoot("topics");
type.setTotalName("totalCount");
type.addField("EQUIPTYPE", "title");
type.addField("EQUIPCODE", "username");
type.addField("TOTAL", "forumtitle");

JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>(type);

final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);

ListStore<ModelData> store = new ListStore<ModelData>(loader);

final Grid<ModelData> grid = new Grid<ModelData>(store, cm);
.....


and this is my server codes, I have develop this server using PHP :


function getJson() {
$scriptTag = true;
header("Content-type: text/javascript");
$ci = & get_instance();
$q = $ci->db->query("myOwnQuery");
$r = $q->result();
$r = array('totalCount' => '5555', 'topics' => $r);
echo json_encode($r);
......


I had an 'invalid label' error when load data, am I doing wrong with my code?Sorry for my bad English,cause I'm from Indonesia.

aldi_farad
14 Mar 2012, 12:17 AM
It's done...