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

Toolbar().Create() collides with Filterable()

4 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 07 Jun 2013, 09:25 AM

Hi!

I've a inline editable Kendo Grid configured  with a create button in the toolbar, paging is activated, the data are sorted and the datasource is an ajax datasource. This configuration generates multipe problems and I need a fix or a workaround for this, because I can't disable the sorting.

If I'm not on page 1 in the grid and I press the create button nothing happens. I can press the button multiple times and nothing happens. If I go back to the first page I have one empty data line for every pressed button in the grid. And it's not a javascript error.

Maybe it's possible to switch the page during pressing the create button but how?

If I've a sorting with no results in the grid and press the create button nothing happens too. After I clear the sorting I have one empty data entry for every pressed create button in the grid too.

I understand the technical reason and know about the workaround, but not the normal user. :-)

How I can handle the multipe button press?

Thank you for help!

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 10 Jun 2013, 09:43 AM
Hello Michael,


I'll go straight to your questions. Regarding the first one, I was unable to reproduce it on my side and in the demos. The new row is always created on current page.

Regarding your second question, this behavior is expected, when the dataSource is filtered and/or sorted on the client side, because when the new record is created outside the current view, it cannot be edited. As a workaround I would suggest you to implement a custom toolbar command, which first clears filters and sorting and then adds the new row.
E.g.
function createNewRecord() {
    var grid = $("#grid").data("kendoGrid");
    grid.dataSource.filter({});
    grid.dataSource.sort({});
    grid.addRow();
}

I hope that this information was helpful for you. I wish you a great day!

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michael
Top achievements
Rank 1
answered on 10 Jun 2013, 11:15 AM
Hi Dimiter,

 yes the demo works. BUT the demo is NOT configured for sorting and not sorted. If I disable the sorting in my solution the create item function is working as expected too.

edit: Your right, the phrase "Sortable()" is missing in the headline. The right headline must be "Toolbar().Create() collides with Sortable()". :-)

Thank you for the code, but this is a unattractive workaround. My customer will ask me, why the sorting is removed if he creates a new item.

Have you another solution for me?

Thanks a lot!
0
Accepted
Dimiter Madjarov
Telerik team
answered on 10 Jun 2013, 12:31 PM
Hi Michael,


An alternative approach would be to use server sorting instead. You could find an example on how to achieve this in the following Code Library.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michael
Top achievements
Rank 1
answered on 10 Jun 2013, 02:07 PM
Ok this works, but the server requests will increase. But in this case, we have enough power.

Thanks a lot! :-)
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Michael
Top achievements
Rank 1
Share this question
or