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

AutoPopup Toolbar.create template

1 Answer 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kahl
Top achievements
Rank 1
Kahl asked on 03 May 2017, 02:34 AM

I have a editible grid with a ToolBar.Create that pops up a template,  I would like to have the template popup when entering the view and grid is 1st displayed,  Ie On datbound or similar

 

how can the grid enter create mode and have the popuyp appear automatically.

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 04 May 2017, 03:21 PM
Hi Kahl,

The behavior you would like to implement can be achieved with a bit of additional code. You can handle the DataBound event for the Grid component. Then you can use the addRow() method in order to open the popup edit form.

Note that DataBound event will be fired automatically on every data related operation (e.g. paging, sorting, editing). Thus to prevent the popup insert form from showing every time you can use a flag.

The code snippets below outline the approach:

Adding DataBound handler:

.Events(e=>e.DataBound("onDataBound"))

JavaScript:

var flag = false;
 
function onDataBound(e) {
    var grid = this;
    if (!flag) {
        setTimeout(function () {
            grid.addRow();
            flag = true;
        });
    }
}


Regards,
Viktor Tachev
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.
Tags
Grid
Asked by
Kahl
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or