How set culture for grid
This not working:
<script type="text/javascript">
kendo.culture("ro-RO");
</script>
Hello everybody,
I'm new with Kendo, I'm trying to create one grid that receiving data from couple of mysql tables(3-5 tables)(simple mysql select - join statement).
I thought that "readJoin" should be the answer for my question, but I could not find any detail on this function.
I hope someone could lead me to the answer.
Thank you very much.
Nitay.
Hi.
We have a Kendo Grid with the Filter Row activated (using Kendo UI PHP), the web page has the Spanish culture loaded so date formats are shown in Spanish.
One of the Grid columns is a date created with ->format('{0:dd/MM/yyyy}', this shows all dates in Spanish format on the Grid and New/Update forms as expected.
The Grid Filter Row command ->mode("row"); on the other hand creates a date picker with the default date format MM/dd/yyyy thus using a different format to filter the column.
If the users picks a date from the mini calendar, the filter works as expected (although it shows the date in a different format than the Grid). On the other hand if they type it in manually using the format shown in the Grid the filter does not work as they have used the wrong format for the field.
Any ideas on how to get a Filter Row date picker created in PHP to accept the culture loaded in the page?
Regards
Michael Mc Cudden
Hi, I used the sample code for inline editing and just change some parameters but the gird doesn't populate any data. Can you help help me ?
This is my code:
<!DOCTYPE html>
<
html
>
<
head
>
<
title
></
title
>
<
link
rel
=
"stylesheet"
href
=
"styles/kendo.common.min.css"
/>
<
link
rel
=
"stylesheet"
href
=
"styles/kendo.default.min.css"
/>
<
link
rel
=
"stylesheet"
href
=
"styles/kendo.dataviz.min.css"
/>
<
link
rel
=
"stylesheet"
href
=
"styles/kendo.dataviz.default.min.css"
/>
<
script
src
=
"js/jquery.min.js"
></
script
>
<
script
src
=
"js/kendo.all.min.js"
></
script
>
</
head
>
<
body
>
<?
php
require_once 'includes/lib/DataSourceResult.php';
require_once 'includes/lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
header('Content-Type: application/json');
$
request
=
json_decode
(file_get_contents('php://input'));
$
result
=
new
DataSourceResult('');
$type = $_GET['type'];
$
columns
=
array
('ID', 'Control_Name', 'English_Description' );
switch($type) {
case 'create':
$result = $result->create('controls_name', $columns, $request->models, 'ID');
break;
case 'read':
$result = $result->read('controls_name', $columns, $request);
break;
case 'update':
$result = $result->update('controls_name', $columns, $request->models, 'ID');
break;
case 'destroy':
$result = $result->destroy('controls_name', $request->models, 'ID');
break;
}
echo json_encode($result, JSON_NUMERIC_CHECK);
exit;
}
$transport = new \Kendo\Data\DataSourceTransport();
$create = new \Kendo\Data\DataSourceTransportCreate();
$create->url('kendoTest2.php?type=create')
->contentType('application/json')
->type('POST');
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('kendoTest2.php?type=read')
->contentType('application/json')
->type('POST');
$update = new \Kendo\Data\DataSourceTransportUpdate();
$update->url('kendoTest2.php?type=update')
->contentType('application/json')
->type('POST');
$destroy = new \Kendo\Data\DataSourceTransportDestroy();
$destroy->url('kendoTest2.php?type=destroy')
->contentType('application/json')
->type('POST');
$transport->create($create)
->read($read)
->update($update)
->destroy($destroy)
->parameterMap('function(data) {
return kendo.stringify(data);
}');
$model = new \Kendo\Data\DataSourceSchemaModel();
$IDField = new \Kendo\Data\DataSourceSchemaModelField('ID');
$IDField->type('number')
->editable(false);
//->nullable(true);
$controlNameField = new \Kendo\Data\DataSourceSchemaModelField('Control_Name');
$controlNameField->type('string');
// ->validation(array('required' => true));
$model->id('ID')
->addField($IDField)
->addField($controlNameField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')
->errors('errors')
->model($model)
->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)
->batch(true)
->pageSize(20)
->schema($schema);
$grid = new \Kendo\UI\Grid('grid');
$controlName = new \Kendo\UI\GridColumn();
$controlName->field('Control_Name')
->title('Control Name');
$command = new \Kendo\UI\GridColumn();
$command->addCommandItem('edit')
->addCommandItem('destroy')
->title(' ')
->width(172);
$grid->addColumn($controlName, $command)
->dataSource($dataSource)
->addToolbarItem(new \Kendo\UI\GridToolbarItem('create'))
->height(430)
->editable('inline')
->pageable(true);
echo $grid->render();
?>
</
body
>
</
html
>
In the grids examples (popup editing) I found this code but I dont know why it used like that please explain.
if
(
$_SERVER
[
'REQUEST_METHOD'
] ==
'POST'
) {
header(
'Content-Type: application/json'
);
$request
= json_decode(
file_get_contents
(
'php://input'
));
/**
* edit event handler of the curent comments grid.
* Bound at design time by the grid configuration.
*
* @param {event} e
*/
function commentsEdit(e) {
if (e.model.isNew()) {
/**
* get the participant_hotalert_id from parentData and set it into the model
*/
e.model.set('participant_hotalert_id', parentData.participant_hotalert_id);
/**
* get the current status from parentData and set the status of the new comment.
* N.B.
* You have to set the popup window element first or you CANNOT set the value in the model.
* Both have to be set so that the new comment gets the current status when the user does not change it.
*/
var status = parentData.status;
e.container.find('select').val(status);
e.model.set('status', status);
}
}
// line 277
if (isset($properties[$field])) {
$type = $properties[$field]['type'];
} else if ($this->isDate($filter->value)) {
$type = "date";
} else if (array_key_exists($filter->operator, $this->operators) && !$this->isString($filter->value)) {
$type = "number";
}
private function isDate($value)
{
$result = date_parse($value);
return $result["error_count"] < 1 && checkdate($result['month'], $result['day'], $result['year']);
}
ContextErrorException: Notice: Undefined index: startswith in C:\Development\dlg\src\TLF\PortalBundle\Services\DataSourceResultService.php line 294<
br
>