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

3 RadGrid client databind queries

6 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 19 Aug 2008, 01:40 AM
Hi

I am using RadGrid 2008 Q2.

I find that the client-side databind of the grid is extremely well done. We are now doing far less postbacks to the server and because we do everything we possibly can on the client we are gaining a far richer user experience.

I have 3 questions:

1. I have noticed that if we start with a blank grid it defaults to loading 10 empty rows. This is far more when using a hierarchy as it seems to load an extra 5 rows for each master row. As such it can start with 50 rows!

Is there a reason for this?

Presently on the server when the page loads I bind to a dummy class object of just 1 row.

This way I have reduced the HTML response from 117Kb down to 50Kb.

Are there any implications to this? I haven't noticed anything break by taking this approach.


2. When adding items to the grid it all works nicely.. until I add an item past the initial HTML markup. E.g If I start with the default 10 rows, the 11th row is shifted to the right and the data is in all the wrong columns.

This happens as it seems the first 10 rows respect hidden (not invisible) columns but the 11th row onwards does not (in fact it will show the hidden columns).

A further consequence of this is that the hierarchy column (+/-) no longer shows.

How can I avoid this?


3. I couldn't find any examples for a hierarchal grid. At the moment I bind my detail grid in the RowDataBound() client event as it seems that the detail view doesn't automatically fire like it does on the server.

E.g.
if(e.get_item().get_owner().get_name() === 'VenueDetails') //MasterView
{
 var tableView = sender.get_detailTables()[e.get_item()._itemIndexHierarchical];

 // Bind detail to grid
 tableView.set_dataSource(e.get_dataItem().EventMisc);
 tableView.dataBind();
}

Is this the correct approach? I'm not comfortable with it as I am using a protected member: _itemIndexHierarchial.



Kind regards

Mark Eaton

6 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 24 Aug 2008, 10:50 PM
Hi guys it's now been a week.

Can you please assist me here.


Kind regards

Mark Eaton
0
Pavel
Telerik team
answered on 25 Aug 2008, 06:56 AM
Hello Mark,

I am sorry for the delay.
Unfortunately currently hierarchy is not supported when using client-side data binding. Please excuse us for the inconvenience.

Kind regards,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark
Top achievements
Rank 1
answered on 25 Aug 2008, 11:13 PM
Hi Pavel

Thanks for responding.

I couldn't find documentation to say that hierarchy client-side grids weren't supported.

Was there a list of limitations for client-side grid binding that was documented that I missed?

Do you know when hierarchy grids client-side will be supported?

Also can you please answer questions 1 + 2 from my original post. They relate to flat grids as well.


Kind regards

Mark Eaton
0
Pavel
Telerik team
answered on 27 Aug 2008, 11:40 AM
Hello Mark,

Regarding your first question, the Grid is creating empty rows in case there are other controls inside it (e.g. RadNumericTextbox) which cannot be created on the client. That is why it has as much number of rows as is set in the PageSize property. You can try setting PageSize="1", but if you have other controls they will not appear in the other rows.

On your second question if I understand correctly there is a layout problem when inserting items? Can this be reproduced on our online example? It will be helpful if you elaborate, so we can understand you better.

As to the Hierarchy support, we are planning to implement it sometimes in the future, however currently we cannot commit to a specific timeframe.

Regards,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark
Top achievements
Rank 1
answered on 27 Aug 2008, 11:01 PM
Hi Pavel

Thanks again for getting back to me.

Concerning the layout problem when inserting rows it doesn't happen with the online example as it doesn't have any columns with the display='false'.

Say if we have the default of 10 rows rendered on the client, then inserting an 11th row will display the hidden column.

In our case we have such a column near the start of the grid that will be displayed based on a condition. As such the 11th row onwards is skewed to the right.

Hope this makes sense.


Kind regards

Mark Eaton
0
Accepted
Pavel
Telerik team
answered on 01 Sep 2008, 01:22 PM
Hi Mark,

Indeed such problem can be observed in the scenario you describe. You can work around it by using the OnRowDataBound client event-handler of the Grid to hide the column. The code will look similar to this:
function RadGrid1_RowDataBound(sender, args) 
    { 
        var grid = $find("<%=RadGrid1.ClientID %>"); 
        var len = grid.MasterTableView.get_columns().length; 
        for (i=0; i < len; i++) 
        { 
            if (grid.MasterTableView.get_columns()[i].get_uniqueName() == "BirthDate" ) 
            { 
                grid.MasterTableView.hideColumn(i); 
            } 
        } 
    } 

A sample website is attached for reference.

Sincerely yours,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Pavel
Telerik team
Share this question
or