Telerik Forums
UI for PHP Forum
5 answers
224 views

Hopefully I didn't reinvent the wheel here, but I looked around and didn't find a solution. I want to use the DataSourceResult classes with Microsoft SQL Server. When I tried server side paging, it failed. Found that Microsoft added paging support in version 2012, but with a different syntax than other databases. Others use something like "LIMIT x OFFSET y" and MSSQL uses "OFFSET y ROWS FETCH NEXT x ROWS ONLY" for whatever reason. Also, MSSQL won't return results unless you also include a sort column. The Telerik PHP wrapper doesn't seem to account for this.

I found "private function page()" in DataSourceResult.php and had to change it to "protected function page()" so that I can override it, then created this class in my PHP file:

class r2DataSourceResult extends DataSourceResult {
    protected function page() {
         return ' OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY ';
    }
}

 

That solved half of the problem. I still had to guarantee that there is always a sort column, and I didn't find a way to do that from the grid (which is where I would like it). I could configure the grid to sort by a column by default, but if the user changes the sort to nothing, it breaks. So I added a default sort parameter to the querystring for the data URL that I specify in the grid, and if the grid doesn't pass a sort field via JSON, I add the default field from the querystring like this:

if (!isset($request->sort[0]->field)) {
  if (isset($_GET['ds'])) {
    $prop = (object) ['field' => $_GET['ds'], 'dir' => 'asc'];
    $request->sort = array($prop);
  }
else {
  echo "Must provide a default sort field with ds querystring parameter.";
  }
}

 

Maybe there's a way to pass a custom value from the grid along with the other JSON request values, but I haven't found that yet. That would be preferable as a method of forcing a default sort column.

So these two tweaks seem to make it work. I've just started, and haven't tried anything other than read functions. Hopefully I'm not going down a rabbit hole here.

Is there already a solution for the new paging syntax with MSSQL 2012 and up, and for forcing a default sort column to always be included in the query?

 

 

Travis Cotton
Top achievements
Rank 1
 answered on 06 Nov 2017
1 answer
85 views

Guys, can you tell me something about the webservice? Is there any possible to create a webservice in php to get exactly the same results like here:

https://demos.telerik.com/kendo-ui/service/GanttTasks
https://demos.telerik.com/kendo-ui/service/Update
https://demos.telerik.com/kendo-ui/service/Destroy
https://demos.telerik.com/kendo-ui/service/Create

Where could I find something equivalent in php as a similar things to:
https://github.com/telerik/kendo-ui-demos-service:

any tips/links/suggestions?

Neli
Telerik team
 answered on 06 Nov 2017
2 answers
85 views
I'm using a Gantt with remote data source and php wrappers. In the remote data source I'm using php DataSourceResult as also shown in the Kendo UI Demos.
Is there any possible to hide some separate tasks in gantt?. I would like to hide the tasks which have for example field project = 12 on the server side.
Thanks
Valerius
Top achievements
Rank 1
 answered on 01 Nov 2017
5 answers
159 views

I'm on a spreadsheet, i select all the rows and columns in the spreadsheet and then i change the font size from 11 to 12 or 14, it takes me around 20 seconds or more to update the style

Ivan Zhekov
Telerik team
 answered on 27 Sep 2017
5 answers
278 views

I have a grid, based on a View, which calculates a field and displays a button if a record in a related table isn't present. The user can then click the button, to upload an image to this table.

 

This works well, but on inserting a new record, the grid isn't showing this button - as the database hasn't been requeried. I'm assuming I need to add a read of the newly created record, before returning the JSON to the grid, for the insert method.

currently the create is:-

if($type=='create')
{
    try{
        $result = new DataSourceResult("mysql:host=$host;dbname=$dbname", $username, $password);
    }
    catch(PDOException $e)
    {
        echo $e->getMessage();
         
    }
 
 
    $columns = array('IssueNo', 'Title','Month','Year','ReadComic','Characters','Location','Publisher');
    $data = $result->create('comics', $columns, $request, 'ID');
 
     
}

How can change this to do a read of the view and return the new record to the grid?  I'm not sure where the newly created ID would be to achieve this.

Thanks

Stefan
Telerik team
 answered on 19 Sep 2017
11 answers
318 views

Hello

 

I've been looking for the solution for this and still empty.

I'm trying to add a parameter to a filter when it loads and I'm doing what It's supposed to be the correct option but no luck for me.

Some one who could help me?

01.$DateField = new \Kendo\Data\DataSourceSchemaModelField('date');
02.$DateField->type('date');
03. 
04.$dataSource = new \Kendo\Data\DataSource('dataSource');
05. 
06.$filterItem = new \Kendo\Data\DataSourceFilterItem();
07.$filterItem->field('DateField');
08.$filterItem->operator('eq');
09.$filterItem->value(date('d-m-Y'));
10.                
11.$dataSource->transport($transport)
12.                     ->pageSize(10)
13.                     ->schema($schema)
14.                     ->serverPaging(true)
15.                     ->addFilterItem($filterItem);
16. 
17.$Date = new \Kendo\UI\GridColumn();
18.$Date->field('date')
19.          ->title(ucfirst(trans('labels.date')))
20.          ->format('{0:dd/MM/yyyy}');

 

 

 

 

 

 

Konstantin Dikov
Telerik team
 answered on 13 Sep 2017
4 answers
335 views

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

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 24 Aug 2017
1 answer
61 views
How to create title of Header Row Multicolumn Alignment At of The Middle Merge Rows. See Picture
Boyan Dimitrov
Telerik team
 answered on 14 Aug 2017
1 answer
176 views

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

Stefan
Telerik team
 answered on 12 Jul 2017
1 answer
105 views

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.

Preslav
Telerik team
 answered on 26 Jun 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
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?