I'm just starting a project using PHP, rather than my more familiar ASP.NET MVC.
I'm trying to get a grid with a pop-up editor working, containing a field bound to a drop-down list. I've (finally) got this working, but even though I've added the required validation to the field, and the field in the table is not nullable, the form is still allowing blank entries, which are populated as ''.
The field is defined as:-
$monthField
=
new
\Kendo\Data\DataSourceSchemaModelField(
'Month'
);
$monthField
->type(
'string'
)
->validation(
array
(
'required'
=>true));
The column is :-
$monthColumn
=
new
\Kendo\UI\GridColumn();
$monthColumn
->field(
'Month'
)
->editor(
'monthDropDownEditor'
);
and the validator is set up as:-
function
monthDropDownEditor(container, options) {
$(
'<input data-text-field="Month" data-value-field="Month" data-bind="value:'
+ options.field +
'"/>'
)
.appendTo(container)
.kendoDropDownList({
autoBind:
false
,
dataSource: {
schema: {
data:
"data"
},
transport: {
read: {
url:
"dataSourceMonths.php?type=read"
,
type:
"POST"
,
dataType:
"json"
}
}
},
optionLabel:
"Select month..."
,
});
}
What do I need to do to make this a required field, and pop-up a validation message?
Thanks
Hi,
We use the Excel export feature of your component.
In the export I have few cells that contains multi-line text.
In the exported file, the line height is set to the default value.
Is it possible to set the line height to some kind of "auto" to fit the content and expand if necessary ?
Best regards
Emmanuel
Hi,
I have tried the example of information retrieve from database and show in grid.But failed
json outputs coming properly. See below. but not showing data in grid.Find attached files of code used php.
[{"id":"38","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 13:55:33.000000","edited_date":null,"deleted_date":null},{"id":"39","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 13:56:10.000000","edited_date":null,"deleted_date":null},{"id":"40","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 13:58:44.000000","edited_date":null,"deleted_date":null},{"id":"41","employee_no":"EMP41","firstname":"mohini","middlename":"vishal","lastname":"patil","email":"pmohini@gmail.com","dob":"1995-11-11 00:00:00","image":"image.jpg","is_active":"0","is_deleted":"0","created_date":"0000-00-00 00:00:00.000000","edited_date":"2017-06-13 09:11:13.000000","deleted_date":"0000-00-00 00:00:00.000000"},{"id":"42","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 13:59:02.000000","edited_date":null,"deleted_date":null},{"id":"43","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 13:59:20.000000","edited_date":null,"deleted_date":null},{"id":"44","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:00:53.000000","edited_date":null,"deleted_date":null},{"id":"45","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:02:13.000000","edited_date":null,"deleted_date":null},{"id":"46","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:10:54.000000","edited_date":null,"deleted_date":null},{"id":"47","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:12:29.000000","edited_date":null,"deleted_date":null},{"id":"48","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:13:22.000000","edited_date":null,"deleted_date":null},{"id":"49","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:35:09.000000","edited_date":null,"deleted_date":null},{"id":"50","employee_no":"EMP1","firstname":"prajakta","middlename":"prakash","lastname":"dhanke","email":"pdhanke@gmail.com","dob":"0000-00-00 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":"2017-06-12 14:56:16.000000","edited_date":null,"deleted_date":null},{"id":"51","employee_no":"EMP41","firstname":"mohini","middlename":"vishal","lastname":"patil","email":"pmohini@gmail.com","dob":"1995-11-11 00:00:00","image":"image.jpg","is_active":"0","is_deleted":null,"created_date":"0000-00-00 00:00:00.000000","edited_date":null,"deleted_date":null},{"id":"52","employee_no":"EMP41","firstname":"mohini","middlename":"vishal","lastname":"patil","email":"pmohini@gmail.com","dob":"1995-11-11 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":null,"edited_date":"2017-06-13 07:28:13.000000","deleted_date":null},{"id":"53","employee_no":"EMP41","firstname":"mohini","middlename":"vishal","lastname":"patil","email":"pmohini@gmail.com","dob":"1995-11-11 00:00:00","image":"image.jpg","is_active":"1","is_deleted":null,"created_date":null,"edited_date":"2017-06-13 08:44:14.000000","deleted_date":null}]
Thank you.
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