Grid Popup and templating

2 posts, 0 answers
  1. Alessio
    Alessio avatar
    9 posts
    Member since:
    Aug 2016

    Posted 08 Mar Link to this post

    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


  2. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    300 posts

    Posted 10 Mar Link to this post

    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 "mygrid". 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 visualization (charts) and form elements.
Back to Top