As on title , i have an example grid from a mysql table, one of field was a online field, he take ( s=online or n=online)
inside a method post if -->
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
i put this -->
// DECODE TABLE FOR ( Online/Offline )
case 'online':
$result = $result->read('categories', $decode, $filterForOnline);
break;
and after this -->
if ($type != 'online') {
$online = new DataSourceResult('mysql:host=localhost;dbname=<dbname>,<user>,<password>, $options);
$online = $online->read('categories', $decode);
$data = &$result['data'];
for ($index = 0, $count = count($data); $index < $count; $index++) {
if ($type == "create") {
$onlineCode = $data[$index]->online;
} else {
$onlineCode = $data[$index]['online'];
}
foreach ($online['data'] as $status) {
if ($status['code'] == $onlineCode) {
if ($type == "create") {
$data[$index]->Status = $status;
} else {
$data[$index]['Status'] = $status;
}
break;
}
}
}
}
the definition of colum is this -->
$category = new \Kendo\UI\GridColumn();
$category->field('Status')
->title('Status')
->template('#=Status.description#')
->editor('onlineDropDownEditor')
->width(180);
and the add to the grid -->
$grid->addColumn($phonenumber, $category, $idmessage, $textdata, $imagedata, $orderDate, $command)
.....
.....
->sortable(true)
->filterable(true)
.....
the editor -->
function onlineDropDownEditor(container, options) {
$('<input data-text-field="description" data-value-field="code" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataSource: {
schema: {
data: "data"
},
transport: {
read: {
url: "myurl.php?type=online",
type: "POST",
dataType: "json"
}
}
}
});
}
</script>
it's all working, decode, save data etc etc,
just one think not working on that field, filtering and sorting .. how i can modify the code for have this ?
I followed all the steps, but my grid remains empty. Any help greatly appreciated.
<?php
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
// Specify the url of the PHP page which will act as the remote service
$read->url('14streamPDO.php')
->type('POST');
$transport->read($read);
// Configure the model
$model = new \Kendo\Data\DataSourceSchemaModel();
$idField = new \Kendo\Data\DataSourceSchemaModelField('id');
$idField->type('number');
$apynoField = new \Kendo\Data\DataSourceSchemaModelField('apyno');
$apynoField->type('string');
$edadField = new \Kendo\Data\DataSourceSchemaModelField('edad');
$edadField->type('number');
$model->addField($idField)
->addField($apynoField)
->addField($edadField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->model($model);
$dataSource = new \Kendo\Data\DataSource();
// Configure data source
$dataSource->transport($transport)
->schema($schema);
?>
<!-- Create a kendo grid, configure its columns and set its data source.
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<?php
$grid = new \Kendo\UI\Grid('grid');
$idColumn = new \Kendo\UI\GridColumn();
$idColumn->field('id');
$apynoColumn = new \Kendo\UI\GridColumn();
$apynoColumn->field('apyno');
$edadColumn = new \Kendo\UI\GridColumn();
$edadColumn->field('edad');
// Configure columns, enable paging, filtering, sorting and grouping
$grid->addColumn($idColumn, $apynoColumn, $edadColumn)
->sortable(true);
?>
<!-- Output the widget echoing the render method
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<?php
echo $grid->render();
?>
Code for the connection:
<?php
// set up for using PDO
$user = 'root';
$pass = 'root';
$host = 'localhost';
$db_name = 'garchazon';
// set up DSN
$dsn = "mysql:host=$host;dbname=$db_name";
$db = new PDO($dsn, $user, $pass);
$query = "SELECT id, apyno, edad FROM Employee";
$stmt = $db->prepare($query);
$stmt->execute();
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Set response content type
header('Content-Type: application/json');
// Return JSON
echo json_encode($products);
?>
and my json output:
[{"id":"1","apyno":"Rosa Melroso","edad":"18","deporte":"Running"},{"id":"2","apyno":"Debora Melo","edad":"22","deporte":"Gym"},{"id":"3","apyno":"Debora Teste","edad":"23","deporte":"Mountain Bike"},{"id":"4","apyno":"Debora Dora de Cabezas","edad":"66","deporte":"Gym"},{"id":"5","apyno":"Rita Lazo","edad":"33","deporte":"Running"},{"id":"6","apyno":"Aquiles Bailoyo","edad":"28","deporte":"Running"},{"id":"7","apyno":"Omar Icon","edad":"21","deporte":"Running"},{"id":"8","apyno":"Paty Tasalhombro","edad":"27","deporte":"Mountain Bike"},{"id":"9","apyno":"Elber Galarga","edad":"34","deporte":"Gym"},{"id":"10","apyno":"Analisa Melchoto","edad":"55","deporte":"Gym"},{"id":"11","apyno":"Ester Mosobicho","edad":"44","deporte":"Mountain Bike"},{"id":"12","apyno":"Cindy Entes","edad":"36","deporte":"Running"},{"id":"13","apyno":"Lucila Tanga","edad":"32","deporte":"Running"},{"id":"14","apyno":"Marcelo Metio","edad":"53","deporte":"Mountain Bike"},{"id":"15","apyno":"Andy Arrea","edad":"29","deporte":"Running"},{"id":"16","apyno":"Jean Pier Napeluda","edad":"38","deporte":"Mountain Bike"},{"id":"17","apyno":"Jesica Galindo","edad":"21","deporte":"Running"},{"id":"18","apyno":"Monica Galindo","edad":"21","deporte":"Gym"},{"id":"19","apyno":"Rebeca Galindo","edad":"21","deporte":"Running"},{"id":"20","apyno":"Rosa Mile\u00f1o Ardiente","edad":"64","deporte":"Gym"},{"id":"21","apyno":"Elvio Lador","edad":"33","deporte":"Gym"},{"id":"22","apyno":"Debora Dora Dejapis","edad":"34","deporte":"Mountain Bike"},{"id":"23","apyno":"Aquiles Baeza Parada","edad":"23","deporte":"Gym"}]
DFWMM01:telerik.ui.for.php.2017.1.118.commercial kerteszk$ php wrappers/php/scheduler/date-grouping.php
Parse error: parse error in /Users/kerteszk/Downloads/telerik.ui.for.php.2017.1.118.commercial/wrappers/php/scheduler/date-grouping.php on line 204
There's an extra semicolon here:
->addView(array('type' => 'day', 'startTime' => new DateTime('2013/6/13 7:00')),
array('type' => 'week', 'selected' => true, 'startTime' => new DateTime('2013/6/13 7:00')), 'month', 'timeline');
->dataSource($dataSource);
hello
I need an example of source code.
thank you
Hi,
I test your examples and I want to make a table with a PopUp and a DropDownList but its not working. Is there a functional example somewhere?
Thank you.
Hi,
I have build a nice spreadsheet with the UI for PHP.
The PHP script retrieves data from a MySQL database and populates the spreadsheet.
Now, I try to POST the spreadsheet data to another PHP script that will update the MySQL database tables.
Unfortunately I do not manage to post the spreadsheet data to the PHP script. It keeps posting an empty array.
If I use the demo version "Spreadsheet / Server Import/Export" - HTML5/JavaScript source (http://demos.telerik.com/kendo-ui/spreadsheet/server-side-import-export) and just set the "<form action='' to my PHP script, it works as a charm. But it does not post the data from the spreadsheet I created with PHP.
Does anybody knows what to do to get this working?
I have attached the php script.
Hi,
Just a quick question. Do you have a PHP demo of a tree view in a splitter, where the on click event changes what is in the center-pane (i.e. goes from a Grid View to loading a Map?
Not sure how this wold work considering the PHP has already run?
Best Regards
Tom.
Hi,
it looks like there is a bug in the separator function of the MenuItem class (\Kendo\UI\MenuItem). It uses the variable $value which can't be passed to the function when calling it.
I am using the latest Kendo UI and UI for PHP version (2016.2.714). This is the original source code from MenuItem.php lines 42 to 48:
/**
* Specifies the item should render separator
* @return \Kendo\UI\ContextMenuItem
*/
public
function
separator() {
return
$this
->setProperty(
'separator'
,
$value
);
}
I think that should be something like this:
/**
* Specifies the item should render separator
* @param boolean $value
* @return \Kendo\UI\ContextMenuItem
*/
public
function
separator(
$value
) {
return
$this
->setProperty(
'separator'
,
$value
);
}
Best regards
Thomas