Welcome Guest Search | Active Topics | Sign In | Register

Grid AutoHeight - New Row Javascript Error Options
RB0135
Posted: Wednesday, October 16, 2013 11:31:32 PM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Hi,

I have the latest version of EO.

Using the grid in the Excel style of editing.

I need the Grid to auto adjust the height as rows get added. I have scrollbars off (which I understand will make the Grid adjust the height automatically).

When I go to add data in a new line, it creates a new row (which is normal in Excel Style), and the height of the grid adjusts.

However, the new row has no gridlines. When I click in the first column of the new row, I get the cursor then a JavaScript error: "Unable to get property eo_w of underfined or null reference"

Now, if I turn on the scroll bars (which turns off the auto height) then I can enter as many new lines as I want without any errors.

So, it seems that in "Excel mode" the auto height seems not to complete creating the new row or fails in some other respect.

Any ideas?
eo_support
Posted: Thursday, October 17, 2013 9:44:11 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Thanks for reporting the issue. We are aware of this, the Grid is mainly designed for scrolling (because the standard ASP.NET Grid can handle the non-scrolling situation quite fine) so it has a number of issues when scroll bar is off. We will look into it and see what we can do.

Thanks!
RB0135
Posted: Friday, October 18, 2013 5:54:09 AM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Great.. Thanks, I hope you can find a fix.

What if I manually increase the grid (which I have seen some code to do). Will that work, or exhibit the same issue?

Thanks.
eo_support
Posted: Friday, October 18, 2013 9:31:06 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

I believe the root of the problem is not the Grid's size but Grid.ScrollBars, for that property you must set it to Auto.

Thanks!
RB0135
Posted: Friday, October 18, 2013 6:06:31 PM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Oh, ok.. thanks for that information.. I'll give it a try.

Thanks
RB0135
Posted: Saturday, October 19, 2013 5:36:05 PM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Hi, I tested by setting the Scrollbars to Auto, but the Grid doesn't show at all, even though I have 10 rows and a header in the Grid. Setting Scrollbars back to none, the Grid shows. Do you have to set a Height when using Auto? If so, then that defeats the purpose of the Grid's height autosizing.
RB0135
Posted: Thursday, October 24, 2013 12:39:19 AM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Still having issues with this and I cant understand why auto grid height is such as hassle.

Again, if I set the scrollbars to "none" and a new row is added, then the system doesn't add the new row properly.

If I set scrollbars to auto, then the grid has no height to it just a single line representing the border.

I have even tried to do it manually, yet the command is totally ignored.

When trying manually, in my initGrid clientside routine or when the cell is selected (as there is nothing that seems to fire when a row is added... IS THERE?) here is the following code I use:

Code: JavaScript
function initPCGrid() {
     //Routine to do some formatting on the BU_Grid
     var grid = eo_GetObject("PCM_EOGrid");


     var RowCount = grid.getRecordCount();
     grid.setHeight = RowCount * 100; //gives about 700 as I have 7 rows to test of fake data
 }


I also tried grid.setSize = 700 to test it, but nothing happens to the height of the grid

This is the grid definition:

Code: HTML/ASPX
<eo:Grid ID="PCM_EOGrid" runat="server" BorderStyle="none" GridLines="Both" ColumnHeaderDescImage="00050105" GridLineColor="220, 223, 228" ScrollBars="None"
	    ColumnHeaderAscImage="00050104" Width="100%" Font-Size="8.75pt" Font-Names="Tahoma" ColumnHeaderDividerImage="00050103" FullRowMode="False" EnableKeyboardNavigation="True" 
        AllowNewItem="True" ClientSideOnCellSelected="pc_on_grid_cell_selected" IsCallbackByMe="False" ClientSideOnContextMenu="pc_ShowContextMenu" ClientSideOnLoad="initPCGrid">
		<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></FooterStyle>
	    <ItemStyles>
		    <eo:GridItemStyleSet>
			    <ItemHoverStyle CssText="background-color: whitesmoke"></ItemHoverStyle>
			    <SelectedStyle CssText="color:black;"></SelectedStyle>
			    <CellStyle CssText="padding-left:6px;padding-top:2px;"></CellStyle>
			    <ItemStyle CssText="background-color: white"></ItemStyle>
			    <FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right; color: black;"></FixedColumnCellStyle>
		    </eo:GridItemStyleSet>
	    </ItemStyles>
	    <ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;"></ContentPaneStyle>
	    <ColumnHeaderStyle CssText="background-color: #FFFF99;padding-left:8px;padding-top:3px;text;font-weight:bold;font-size:11px"></ColumnHeaderStyle>
            <Columns>
            </Columns>
    </eo:Grid>


The columns get added in code behind.

Can you offer any help?
eo_support
Posted: Thursday, October 24, 2013 10:01:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

setHeight is a function. Not a property. So you would do something like grid.setHeight(700), not grid.setHeight = 700.

Thanks!
RB0135
Posted: Thursday, October 24, 2013 5:38:24 PM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Thanks for that... All examples I had come across while searching was assigning using =, but now I assign it as you have shown, works 100%.

I also discovered that the setHeight only works when Scrollbars are set to Auto.

All I have to do now is to find if I can intercept the "deletecommand" so I can manually shrink the Grid when rows are deleted.
eo_support
Posted: Friday, October 25, 2013 12:00:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You won't be able to intercept the built-in delete command on client side. What you can do is to use your own ButtonColumn with your own command. You can then handle ClientSideOnItemCommand to do delete yourself and adjust the size at the same time.

Thanks!
RB0135
Posted: Friday, October 25, 2013 4:16:37 PM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Ok, that's a great idea..

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.