my php Connector file:
<?php
header('Access-Control-Allow-Origin:*');
require("./../dhtmlxconnector/data_connector.php");
$res=mysql_connect("localhost","root","root");
mysql_select_db("test");
mysql_set_charset("utf8");
$data = new JSONDataConnector($res,"MySQL");
$data->set_encoding("utf8");
$data->dynamic_loading(10);
$data->render_sql("SELECT SEC_TO_TIME(a.cd) as cd, a.dz, b.mc AS dq, c.mc as msk FROM vvideo a INNER JOIN vdiqu b ON a.dq = b.dm INNER JOIN vmsk c ON a.msk = c.dm where a.zj='r'","dz","cd,dq,msk");
?>
but list don’t display the data,the return json is:
{ "data":[ {"id":"131059","cd":"00:34:43","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"130382","cd":"00:28:29","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"286959","cd":"00:29:20","dq":"\u6b27\u7f8e","msk":"\u65e0\u7801"}, {"id":"410738","cd":"01:01:40","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"410820","cd":"01:04:04","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"411333","cd":"01:16:48","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"411249","cd":"01:31:35","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"411979","cd":"00:51:10","dq":"\u65e5\u672c","msk":"\u65e0\u7801"}, {"id":"411844","cd":"01:55:04","dq":"\u65e5\u672c","msk":"\u6709\u7801"}, {"id":"411261","cd":"02:13:15","dq":"\u65e5\u672c","msk":"\u6709\u7801"} ], "pos":0, "total_count":273 }
and an ‘Unhandled Error: Cannot convert ‘a’ to object’ error at touchui.js line 4783
4781:zg: function() {
4782:this.g.select && this.data.each(function(a) {
4783:a.$selected && this.select(a.id)
}, this)
},
Hc: function(a, b, c) {
if (!c && !this.callEvent("onBeforeSelect", [a, b]))
return !1;
this.data.item(a).$selected = b;
c ? c.push(a) : (b ? this.o.push(a) : this.o.remove(a), this.yd(a));
return !0
},
I view the example in doc, the php file url ‘http://www.dhtmlx.com/touch/samples/04_list/books.php’ returns:
{ pos:0, data:[ { id:'x0', title:'Book 0', author:'Author'}, { id:'x1', title:'Book 1', author:'Author'}, { id:'x2', title:'Book 2', author:'Author'}, { id:'x3', title:'Book 3', author:'Author'}, { id:'x4', title:'Book 4', author:'Author'}, { id:'x5', title:'Book 5', author:'Author'}, { id:'x6', title:'Book 6', author:'Author'}, { id:'x7', title:'Book 7', author:'Author'}, { id:'x8', title:'Book 8', author:'Author'}, { id:'x9', title:'Book 9', author:'Author'}, { id:'x10', title:'Book 10', author:'Author'}, { id:'x11', title:'Book 11', author:'Author'}, { id:'x12', title:'Book 12', author:'Author'}, { id:'x13', title:'Book 13', author:'Author'}, { id:'x14', title:'Book 14', author:'Author'}, { id:'x15', title:'Book 15', author:'Author'}, { id:'x16', title:'Book 16', author:'Author'}, { id:'x17', title:'Book 17', author:'Author'}, { id:'x18', title:'Book 18', author:'Author'}, { id:'x19', title:'Book 19', author:'Author'}]}
there is no “total_count”,I delete the “total_count” and save to file, load the file to list ,it work well.
how to write the php file, can somebody give me a example like books.php?