this is the code that I am using for update or create but when starting for edit or create and the bottom name changed to update nothing is working till pressing cancel.
<?php
require_once 'config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
header('Content-Type: application/json');
}
$inputJSON = file_get_contents('php://input');
$paredData = json_decode($inputJSON, TRUE);
$pn= $paredData["filed1"];
$sc = $paredData["filed2"];
/**
* connect to database and execute sqql command
*/
$tableName = '********' ;
$conn = oci_connect($dbuser, $dbpassword , $dbhost.':'.$dbport.'/'.$dbname);
$sqlStatement = 'insert into '.$tableName.'(pn, SC) VALUES ('.$PN.', '.$sc.'.');';
echo $sqlStatement;
$retrive = oci_parse($conn , $sqlStatement);
$execute = oci_execute($retrive);
if ($execute){
echo 'successful';
oci_commit($conn);
LogerFile($databaseLogEvents,$partNo.' inserted Succesfuly. ');
} else {
echo ' error';
oci_rollback($conn);
LogerFile($errorLogEvents,$partNo.' has been Rolleback something went wrong for inserting. ');
}
Hi,
I use the DataSourceResult as the datasource of my grid.
But DateTime are not inserted/updated correctly as they are not correctly formated for MySql.
I had to add the following code to the update method. Same code would also be required for insert I think.
Do you have a better solution than mine ?
$result
= date_parse(
$model
->
$property
);
if
(
$result
[
"error_count"
] == 0)
{
$input_parameters
[] = date_format(
new
DateTime(
$model
->
$property
),
'Y-m-d H:i:s'
);
}
else
{
$input_parameters
[] =
$model
->
$property
;
}
Hello,
I'm trying to solve problem with rendering objects, I've found a solution using custom template for field.
My code:
$interprets = new \Kendo\UI\GridColumn();
$interprets
->field('interprets')
->template('#
var template = "<ul>";
for (var i = 0; i < interprets.length; i++) {
template = template + "<li>" + interprets[i].contact.name+ "</li>";
}
return template + "</ul>";
#')
->title('interprets');
But the result is not what I expected, it can be seen on screenshot attached.
Can you please tell me, how to solve this issue?
Thanks a lot
Hi!
I'm using Kendo UI for Php for create a grid, I connect it to mysql db and I get the data.
I get the id and some other data, when I update I have to edit also other field that I don't show to the user. I need to use custom query but I cannot get the data from $request->models
Can someone help me?
Thanks
I have this code :
$myToolBar = new \Kendo\UI\GridToolbarItem();
$myToolBar->text("Test ..");
$myToolBar->template('cust_toolbar');
$grid->addColumn($field1, $field2, $field3, $field4, $command)
->dataSource($dataSource)
->addToolbarItem($myToolBar)
.....
.....
and this template :
<script id='cust_toolbar' type='text/x-kendo-template'>
<a class="k-button k-button-icontext k-grid-add k-cust-add"><span class="k-icon k-add"></span>Add</a>
<a class="k-button k-button-icontext k-grid-save k-cust-save k-state-selected"><span class="k-icon k-save"></span>Save</a>
<a class="k-button k-button-icontext k-grid-update k-cust-update k-state-selected"><span class="k-icon k-update"></span>Update</a>
<a class="k-button k-button-icontext k-grid-cancel k-cust-cancel k-state-selected"><span class="k-icon k-cancel"></span>Cancel</a>
<a class="k-button k-button-icontext k-grid-edit k-cust-edit"><span class="k-icon k-edit"></span>Edit</a>
<a class="k-button k-button-icontext k-grid-delete k-cust-delete"><span class="k-icon k-delete"></span>Delete</a>
</script>
But nothing is displayed on grid, what is wrokg ?
Thanks
Hello,
I have a condiderble issue with Kendo UI Grid.
First of all, it loads data by AJAX call after loading grid itself instead od loading and inserting data on server.
But back to my issue, with this code, my grid is generated, it calls AJAX request, but it doesn't show them in grid.
Code:
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('http://127.0.0.1/api/records')
->contentType('application/json')
->type('GET');
$create = new \Kendo\Data\DataSourceTransportCreate();
$create->url('http://127.0.0.1/api/records')
->contentType('application/json')
->type('POST');
$update = new \Kendo\Data\DataSourceTransportUpdate();
$update->url('http://127.0.0.1//api/records')
->contentType('application/json')
->type('UPDATE');
$destroy = new \Kendo\Data\DataSourceTransportDestroy();
$destroy->url('http://185.33.145.45/api/records')
->contentType('application/json')
->type('DELETE');
$transport
->read($read)
->create($create)
->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);
$nameField = new \Kendo\Data\DataSourceSchemaModelField('name');
$nameField->type('string')
->validation(array('required' => true));
$YearField = new \Kendo\Data\DataSourceSchemaModelField('year');
$YearField->type('number')
->editable(true)
->nullable(true);
$model
->addField($IDField)
->addField($YearField)
->addField($nameField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')
->errors('errors')
->model($model)
->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource
->transport($transport)
->pageSize(30)
->schema($schema);
$grid = new \Kendo\UI\Grid('grid');
$name = new \Kendo\UI\GridColumn();
$name
->field('name')
->title('název');
$year = new \Kendo\UI\GridColumn();
$year
->field('year')
->title('rok vydánÃ');
$excel = new \Kendo\UI\GridExcel();
$excel->fileName('Kendo UI Grid Export.xlsx')
->filterable(true)
->proxyURL('excel-export.php?type=save');
$grid
->addColumn($name, $year)
->dataSource($dataSource)
->excel($excel)
->groupable(true)
->sortable(true)
->filterable(true)
->navigatable(true)
->editable(true)
->pageable(true)
->addToolbarItem(new \Kendo\UI\GridToolbarItem('create'),
new \Kendo\UI\GridToolbarItem('save'), new \Kendo\UI\GridToolbarItem('cancel'))
->height(400);
$gridHTML = $grid->render();
Hello,
i have many iusse with to add parameters to a gris that read from json file
<?php
require_once 'lib/DataSourceResult.php';
require_once 'lib/Kendo/Autoload.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('data\products.php')
->type('POST');
$transport->read($read);
// Configure the model
$model = new \Kendo\Data\DataSourceSchemaModel();
$productNameField = new \Kendo\Data\DataSourceSchemaModelField('SPECIFIC_NAME');
$productNameField->type('string');
..
?>
i wanto to add to file product.php ($read->url('data\products.php') ) a parameter that return from a function
can oyu help me?
thanks you so much
Can someone help me with popup and templating, i have this code, and can't work
$gridtemplate = new \Kendo\UI\GridEditable();
$gridtemplate->mode('popup');
$gridtemplate->update(true);
$gridtemplate->template('mygrid');
$grid->addColumn($phonenumber, $category, $idmessage, $textdata, $imagedata, $orderDate, $command)
->dataSource($dataSource)
->addToolbarItem(new \Kendo\UI\GridToolbarItem('save'), new \Kendo\UI\GridToolbarItem('cancel'))
->sortable(true)
->height(900)
->filterable(true)
->editable($gridtemplate)
->selectable(true)
->save('grid_save_event')
->cancel('grid_cancel_event')
->change('grid_change_event')
->remove('grid_remove_event')
->edit('grid_edit_event')
->pageable(true);
echo $grid->render();
?>
<script id="grid-template" type="text/x-kendo-template">
</script>
function mygrid()
{
var template = kendo.template("<div id='box'>#= phonenumber #</div>");
var result = template(data); //Pass the data to the compiled template
console.log("phonenumber :"+phonenumber);
console.log("result :"+result);
$("#grid-template").html(result); //display the result
}
Thanks