This is a migrated thread and some comments may be shown as answers.

Grid Popup and templating

1 Answer 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alessio
Top achievements
Rank 1
Alessio asked on 08 Mar 2017, 09:28 AM

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


1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 10 Mar 2017, 07:20 AM
Hello Alessio,

I have already responded to the support ticket on the same subject.

We recommend choosing a single thread to handle related issues/questions for the most efficient resolution. I will paste my response here are well, however, I suggest if more assistance is needed to continue our conversation in the support ticket.

It seems to me that defining the template as a function is not necessary since there is no custom logic to be executed in the function "". I would suggest testing the Kendo UI Grid with the template defined as below(note that in this case, the property is templateId as opposed to the template):


$gridtemplate->templateId('popup_editor');

Alternatively, if you were to use a function to render the template, the function should return the resulting string, i.e:

function mygrid(){
 return kendo.template($("#popup_editor").html());
}

Thank you for your understanding.

Kind Regards,
Alex Hajigeorgieva
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Grid
Asked by
Alessio
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or