Telerik Forums
UI for PHP Forum
2 answers
129 views

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. ');
    }

Stefan
Telerik team
 answered on 16 Jun 2017
2 answers
148 views

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;
}
Emmanuel
Top achievements
Rank 1
 answered on 26 Apr 2017
3 answers
110 views
By utilizing the PHP wrapper, I have set a grid field as type boolean.

The field however does not bind to the datasource, as the field ends up with value false even when datasource field value is 1 (true).

In MySQL database, the field was first set to TINYINT(1) then to BOOLEAN with same resulting missing binding.

How to bind such a grid field to a boolean datasource field?

And how to let this boolean field come up as a checkbox, not as true & false? I think such boolean fields in general should always end up as checkboxes by default, not as true & false, yes & no etc...
Emmanuel
Top achievements
Rank 1
 answered on 20 Apr 2017
1 answer
73 views

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

 

Viktor Tachev
Telerik team
 answered on 13 Apr 2017
1 answer
156 views

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'm trying
I'm trying
I'm trying
Boyan Dimitrov
Telerik team
 answered on 04 Apr 2017
1 answer
63 views
I am using REST API, is there a way ho to create new items with POST request?
Stefan
Telerik team
 answered on 29 Mar 2017
2 answers
149 views

 

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

 

 

 

Stefan
Telerik team
 answered on 28 Mar 2017
4 answers
357 views

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();

Richard
Top achievements
Rank 1
 answered on 27 Mar 2017
1 answer
124 views

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

 

 

Stefan
Telerik team
 answered on 24 Mar 2017
1 answer
107 views

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


Alex Hajigeorgieva
Telerik team
 answered on 10 Mar 2017
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?