Dear all,
I have been trying for a cuple of days to get data from the database into the KendoUI GRID. For some reason the data doesn't show, so I ran a test and as far as I can see it is working as it is supposed to.
My test.php file looks like this:
And my index2 file looks like this:
Now you can see in the php-file I created a text file to check which data is echo-ed. That data looks like this:
{"total":2,"data":[{"CLIENTEMEA":127,"CLIENTNAME":"Telenet","CLIENTKVK":123456789},{"CLIENTEMEA":129,"CLIENTNAME":"Tele2","CLIENTKVK":987654321}]}
Which is correct. I made 2 test entries to see what's what.
Now when I start the page, the GRID always shows up empty. It's also not possible to add new records. When I do the submit button doesn't submit the data, so all I can do is cancel.
Can anyone see anything wrong with the code? Are there other tests I could do to find out the problem?
Any help would be appreciated.
Thanks in advance,
Dennis Biemans.
I have been trying for a cuple of days to get data from the database into the KendoUI GRID. For some reason the data doesn't show, so I ran a test and as far as I can see it is working as it is supposed to.
My test.php file looks like this:
<?php $sRootDir = "../.."; require_once ($sRootDir.'/lib/Kendo/DataSourceResult.php'); require_once ($sRootDir.'/lib/Kendo/Autoload.php'); require_once ($sRootDir."/include/includeDomain.php"); require_once ($sRootDir."/include/includeLib.php"); if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $sType = $_GET["type"]; $sRequest = json_decode(file_get_contents('php://input')); //Password data removed $pResult = new DataSourceResult(**dns**, **user**, **password**); $aColumns = array('CLIENTEMEA', 'CLIENTNAME', 'CLIENTKVK'); switch($sType) { case 'create': $sResult = $pResult->create('RULES_CLIENTS', $aColumns, $sRequest->models, 'CLIENTEMEA'); break; case 'read': $sResult = $pResult->read('RULES_CLIENTS', $aColumns, $sRequest); break; case 'update': $sResult = $pResult->update('RULES_CLIENTS', $aColumns, $sRequest->models, 'CLIENTEMEA'); break; case 'destroy': $sResult = $pResult->destroy('RULES_CLIENTS', $sRequest->models, 'CLIENTEMEA'); break; } echo json_encode($sResult, JSON_NUMERIC_CHECK); $FileName = "testFile.txt"; $FileHandle = fopen($FileName, 'w') or die("can't open file"); fwrite($FileHandle, json_encode($sResult, JSON_NUMERIC_CHECK)); fclose($FileHandle); exit; } require_once($sRootDir."/html/tpbilling/client/index2.html");?><div id="grid"></div><script>jQuery(function(){jQuery("#grid").kendoGrid({"columns":[{"field":"CLIENTEMEA","width":100,"title":"Client EMEA"},{"field":"CLIENTNAME","width":400,"title":"Client Name"},{"field":"CLIENTKVK","width":100,"title":"KVK Number"}],"dataSource":{"transport":{"create":{"url":"../../tpbilling/client/test.php?type=create","contentType":"application\/json","type":"POST"},"read":{"url":"../../tpbilling/client/test.php?type=read","contentType":"application\/json","type":"POST"},"update":{"url":"../../tpbilling/client/test.php?type=update","contentType":"application\/json","type":"POST"},"destroy":{"url":"../../tpbilling/client/test.php?type=destroy","contentType":"application\/json","type":"POST"},"parameterMap":function(data) {return kendo.stringify(data);}},"batch":true,"pageSize":20,"schema":{"data":"data","errors":"errors","model":{"id":"CLIENTEMEA","fields":[{"field":"CLIENTEMEA","type":"number","validation":{"required":true}},{"field":"CLIENTNAME","type":"string","validation":{"required":true}},{"field":"CLIENTKVK","type":"number","validation":{"required":true}}]},"total":"total"}},"toolbar":[{"name":"create"}],"height":430,"editable":"popup","pageable":true});}); </script>Now you can see in the php-file I created a text file to check which data is echo-ed. That data looks like this:
{"total":2,"data":[{"CLIENTEMEA":127,"CLIENTNAME":"Telenet","CLIENTKVK":123456789},{"CLIENTEMEA":129,"CLIENTNAME":"Tele2","CLIENTKVK":987654321}]}
Which is correct. I made 2 test entries to see what's what.
Now when I start the page, the GRID always shows up empty. It's also not possible to add new records. When I do the submit button doesn't submit the data, so all I can do is cancel.
Can anyone see anything wrong with the code? Are there other tests I could do to find out the problem?
Any help would be appreciated.
Thanks in advance,
Dennis Biemans.