Telerik Forums
UI for PHP Forum
4 answers
509 views
Hello,

I am using Telerik UI for PHP Grid component. And I want to use PHP function in column template, for ex.: 

#if (kendo.toString(kendo.parseDate(data.NearestTaskDate), "yyyy-MM-dd") === date(\'Y-m-d\')) {#
<div class="feed image">
<i class="#:NearestTaskTypeIcon# icon bg-yellow"></i>
</div>

where date is PHP function. However, browser console message says that date is not defined. How can fix it? Thank you.
Vishal
Top achievements
Rank 1
Iron
 answered on 27 Jul 2021
3 answers
306 views
just wondering if anyone has a solution to using the expand/collapsegroup events and detailexpand/collapse events to control multiple grids (both grids contain the same rows with the same columns with a unique identifier - ID - The two grids just show additional data). In other words if I open a group/detail on one grid the other grid opens closes.
Tsvetomir
Telerik team
 answered on 10 May 2021
2 answers
173 views

HI 

  I use the official Remote Binding example,But with no results returned, I get an empty GRID. could you help me to check my code?  I'm sure there is no problem with JSON-Returning File Test02.php. It can return JSON results。

 
li
Top achievements
Rank 1
 answered on 03 Mar 2021
7 answers
110 views

Is it possible to display cards in grid?

Example:

- Have a 8 x 8 grid. 

- Several cards displayed vertically in each cell.

- Ability to drag cards between cells

Martin
Telerik team
 answered on 13 Aug 2020
3 answers
93 views

I have a strange issue. I have a grid, with a pop-up editor template, with a boolean field.

This has been working fine until recently, when (I assume after an update to PHP or the MariaDB backend) inserting new records now fails when the checkbox is left unchecked.

After a lot of searching, I found the error message being returned through JSON.

 

It is {"errors":["Incorrect integer value: '' for column 'Read' at row 1"]} . It seems the grid is passing '' instead of 0, for a false value.

If the checkbox is ticked, a new record is inserted without a problem. The issue also affects updates, the checkbox can be ticked, but not unchecked.

The field is defined as a boolean in the model definition:-

$readField = new \Kendo\Data\DataSourceSchemaModelField('Read');
   $readField->type('boolean');

 

And the checkbox is defined as :-

<p><label>Read?:</label><input type="checkbox" name="Read" data-bind="value:Read" > </p>

In the editor template definition

I have tried updating to the latest version of KendoUI, but the problem still persists

The field is a type TinyInt in the database, and is non nullable.

Angel Petrov
Telerik team
 answered on 25 Oct 2018
1 answer
224 views

We are having an issue with our grid filtering when it comes to the "Is Null" and "Is Not Null" filters. We are filtering server side via the DataSourceResult.php file, when a column filter is applied with isnull or isnotnull we are getting a mySQL error:

{"error":{"type":"PDOException","message":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?)' at line 1","file":"\/vagrant\/pimcore-root\/website\/lib\/Kendo\/lib\/DataSourceResult.php","line":47}}

 

Filter sent in the request:

 "filter":{"logic":"and","filters":[{"field":"ItemName","operator":"contains","value":"test"},{"field":"IsSpecialPrint","operator":"isnotnull","value":""}]}

 

We're hitting the DataSourceResult result like in the example:

$request = json_decode(file_get_contents('php://input'));
 $result = new DataSourceResult();

Grid datasource JS:

var gridDataSource = new kendo.data.DataSource({
            transport:{
                read:{
                    url: "/gridRead",
                    type: "POST",
                    contentType: "application/json"
                },
                parameterMap: function(data){
                    return kendo.stringify(data);
                },
                prefix: ""
            },
            pageSize: 25,
            page: 1,
            total: 0,
            serverPaging: true,
            serverSorting: true,
            serverFiltering: true,
            serverGrouping: true,
            serverAggregates: true,
            sort: [{
                field: "SKU",
                dir: "asc"
            }],
            schema:{
                data: "data",
                total: "total",
                errors: "errors",
                model: {
                    id: "oo_id",
                    fields: schema
                }
            }
        });

This error seems to occur on all columns regardless if boolean/number/string.Could this be an error within the DataSourceResult.php file filtering logic or something with the encoding of filter values?

We are using version R1 2017.

Thanks.

Stefan
Telerik team
 answered on 09 Mar 2018
1 answer
128 views

Hi, I try to get the data into the grid for short number (9 digit) it display correctly in the grid but when I fetch long number (15 digits) it will display wrong numbers

for example number 200148078262119 will display as 200148078262120 in the grid. I tried to print_r the data from php and the data that php retrieve is correct.

I open up the inspect element in chrome and the jquery .kendoGrid value is scientific notation "2.0014807826212e+14"

May I know is this the culprit for the grid to display incorrect data?

May I know how to solve it?

Stefan
Telerik team
 answered on 08 Mar 2018
5 answers
218 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
5 answers
269 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
314 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
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?