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

Add row to grid without draw again it

5 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 05 Dec 2008, 04:13 PM
Hello!
My scenario is:
1 RadGrid with AllowMultiRowEdit = true
RadGrid ID added to AjaxSettings of AjaxManager
All rows must be in edit mode every time(In-line mode), before users's click to "ОК" button at the bottom of the page.
The user must be able to fill data to grid rows after addition of new rows.
That is - Add Row 1, Add Row 2 ... Then fill cells he wants and push "OK".
To Add new item to Grid I just adds new row to DataTable binded to RadGrid in ItemCommand handler and Rebind() it.
Because of numerous template columns in grid with RadComboBox'es, addition of each next row becomes slower and slower...(>10 Items)
But no need to draw again N Items in grid to add N+1 Item....

The idea was to use client-side API to add new rows, but can't understand how can I do it.
masterTable.insertItem();  takes data from the insertion form editors fields, but the insertion form(external form) not needed in my case...
(so http://demos.telerik.com/aspnet-ajax/Grid/Examples/Client/InsertUpdateDelete/DefaultCS.aspx is not very helpful)
I just want to generate new ID and add row with it in edit mode to grid.

So, how can I add row to grid without re-draw all items? Please, help me by suggestion.

5 Answers, 1 is accepted

Sort by
0
Anton
Top achievements
Rank 1
answered on 08 Dec 2008, 02:59 PM
No any chance to optimize the performance?
0
Maria Ilieva
Telerik team
answered on 09 Dec 2008, 07:27 AM
Hi Anton,

Please review the following help topic which elaborates on this matter.
You could also check out the following code library link to get details on  how to attach client event handlers for the [Add new record] button in the command item (OnClientClick property).
Detecting edit/insert click client-side and cancelling row selection on edit


Regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Anton
Top achievements
Rank 1
answered on 09 Dec 2008, 09:05 AM
Dear Maria,
I know how to insert rows. And I know how to handle client events.
I don't know how to improve performance of the grid in my scenario.
And if I will not find the answer, it can't be possible for me to use RadControls.
Let's try one more time...
1)I have a grid with all rows which are always in EDIT MODE.
It's solved by
            for (int i = 0; i < controlData.Rows.Count + 1; i++) 
            { 
                dataGrid.EditIndexes.Add(i); 
            }

in OnInit handler
2)I have not any insertion form or in-line insertion row. And I don't need it. Each new row must be added by one click to grid and opened in EDIT MODE at once.
3)I have 2 problems:
a)Each new row demand to Rebind() grid to be presented at the client side. So, each of the previously added rows automatically draws again after postback. This cause the decrease of grid performance on each new row addition.
b)Each postback, initiated by any of the column editors inside the grid cause the same problem as case a)

The question is -  how can I improve performance of the grid and fix problems a) and b) ?

My ideas are:
1)Use client-side API to insert new rows and open them in EDIT MODE
        - BUT I DON'T KNOW HOW TO SIMPLY INSERT ROW WITHOUT ANY INSERTION OR EDIT FORM USING CLIENT-SIDE API
2)AJAXify each row of the grid to prevent problem b)
        - BUT I DON'T KNOW HOW TO DO THIS IN DETAIL, AND CAN IT BE POSSIBLE

Does the common practice exists to solve the problems described?

What can you say about it?
0
Accepted
Maria Ilieva
Telerik team
answered on 12 Dec 2008, 07:57 AM
Hi Anton,

It is normal behaviour to have Rebind on each row addition. This is the RadGrid expected behaviour-Rebind itself to update the newly added data and you could not prevent this Rebind. Also note that you could not edit rows on server side and add them on the client.
Regarding the RadAjax usage the only possibility is to have the whole grid ajaxified but not a single GridRow.

Greetings,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Anton
Top achievements
Rank 1
answered on 12 Dec 2008, 08:14 AM
Thank you for the answer, Maria.
I will use Silverlight )
Tags
Grid
Asked by
Anton
Top achievements
Rank 1
Answers by
Anton
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or