Grid View Scroll/Refresh Problem

  1. #1

    Grid View Scroll/Refresh Problem

    I have been searching a lot to fix this problem I am encountering.
    Data shows in a scrollable grid view. There is a edit button to on the grid view. Once edit is clicked, it opens up a new control/page. User makes changes to the data and click save. Once the save is clicked, it goes back to the original page and saves the changes. But it refreshes the grid and the grid is scrolled to the top. I have tried to use
    <Plugins>
    <ext:GridPanelMaintainScrollPositionOnRefresh ID="GridPanelMaintainScrollPositionOnRefresh1" runat="server" ></ext:GridPanelMaintainScrollPositionOnRefresh>
    </Plugins>
    but this doesn't work.
    Last edited by Daniil; Dec 02, 2013 at 3:01 AM. Reason: Please use [CODE] tags
  2. #2
    Hi @bhuter24,

    Welcome to the Ext.NET forums!

    Please provide a test case to reproduce the problem.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @bhuter24,

    Welcome to the Ext.NET forums!

    Please provide a test case to reproduce the problem.
    Well here is the entire thing:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LayInList.ascx.cs" Inherits="Mdoc.Mts.Controls.LayInList" %>
    <%@ Register src="LayInDetail.ascx" tagname="Editor" tagprefix="uc1" %>
    
    <link href="../css/StyleSheet.css" rel="stylesheet" type="text/css" />
      
    <script type="text/javascript">
    
        function refreshGrid() {
            Ext.getCmp('ctl00_Main_ucList_gpData').store.reload();
        }
    
        var exportData = function() {
            var store = gpData.store;
            store.reload();
        };
    
                var detailsRender = function() {
                    return '<img class="imgEdit" ext:qtip="Click to view/edit additional details" style="cursor:pointer;" src="images/vcard_edit.png" />';
                };
    
                var cellClick = function(grid, rowIndex, columnIndex, e) {
                    var t = e.getTarget(),
                    record = grid.getStore().getAt(rowIndex),  // Get the Record
                    columnId = grid.getColumnModel().getColumnId(columnIndex); // Get column id
    
                    //if (columnId == "Lock" | columnId == "MdocNo" | columnId == "OffenderName" | columnId == "Race" | columnId == "Unit" | columnId == "Wing" |  columnId == "LayIn" | columnId == "MealType" | columnId == "ExpireDate" | columnId == "Details") {
                    if (columnId == "Details") {
                        //the ajax call is allowed
                        return true;
                    }
    
                    //forbidden
                    return false;
                };
    
                
    </script>
    
                    <ext:Hidden ID="GridData" runat="server" />
                    <ext:Store 
                        ID="Store1" 
                        runat="server" 
                        OnRefreshData="Data_Refresh"
                        SkipIdForNewRecords="false">
                        <Reader>
                                                <ext:JsonReader IDProperty="OffenderNumber" >
                                                    <Fields>
                                                        <ext:RecordField Name="OffenderId" Type="Int"/>
                                                        <ext:RecordField Name="OffenderNumber" Type="Int"/>
                                                        <ext:RecordField Name="LayInMstrId" Type="Int"/>
                                                        <ext:RecordField Name="LayInSplId" Type="Int"/>
                                                        <ext:RecordField Name="OffenderName" Type="String" />
                                                        <ext:RecordField Name="Race" Type="String" />
                                                        <ext:RecordField Name="Cell" Type="String" />
                                                        <ext:RecordField Name="Unit" Type="String" />
                                                        <ext:RecordField Name="Wing" Type="String" />
                                                        <ext:RecordField Name="ExpDate" Type="Date" />
                                                        <ext:RecordField Name="UnitLockId" Type="Int" />
                                                        <ext:RecordField Name="SpecialityMealId" Type="Int" />
                                                        <ext:RecordField Name="SpecialityMeal" Type="String" />
                                                        <ext:RecordField Name="LayInFlag" Type="Boolean" />
                                                       </Fields>
                                                </ext:JsonReader>
                        </Reader>
                        <Listeners> 
                        <LoadException Handler="Ext.MessageBox.alert('Load failed', response.statusText);" />                            
                        </Listeners>
    
                  </ext:Store>
          
                    <ext:GridPanel 
                        ID="gpData" 
                        runat="server" 
                        Height="280px" 
                        MinHeight="280px"
                        StripeRows="True" 
                        Flex="1" 
                        Cls="x-grid-custom"       
                        AutoExpandColumn="OffenderName" 
                        MinWidth="740px" 
                        BoxMinHeight="250px" 
                        AutoDoLayout="False" 
                        StoreID="Store1"  EnableColumnHide="False" EnableHdMenu="False" TitleCollapse="True">
                            <ColumnModel ID="ColumnModel20" runat="server">
                                            <Columns>
                                                <ext:Column ColumnID="Lock" Header="Lock" DataIndex="Cell" Width="40"></ext:Column>
                                                <ext:Column ColumnID="MdocNo" Header="MDOC#" DataIndex="OffenderNumber" Width="60"></ext:Column>
                                                <ext:Column ColumnID="OffenderName" Header="Offender Name" DataIndex="OffenderName" ></ext:Column>
                                                <ext:Column ColumnID="Race" Header="Race" DataIndex="Race" Width="100"></ext:Column>  
                                                <ext:Column ColumnID="Unit" Header="Unit" DataIndex="Unit" Width="50"></ext:Column>
                                                 <ext:Column ColumnID="UnitLockId" Header="UnitLock" Hidden="true" DataIndex="UnitLockId" Width="50"></ext:Column>
                                                <ext:Column ColumnID="Wing" Header="Wing" DataIndex="Wing" Width="40" ></ext:Column>
                                                <ext:CheckColumn ColumnID="LayIn" Header="LayIn" DataIndex="LayInFlag" Width="30"></ext:CheckColumn>
                                                <ext:Column ColumnID="MealType" Header="Specialty Meal" DataIndex="SpecialityMeal" Width="70" ></ext:Column>
                                               <ext:DateColumn ColumnID="ExpireDate" Header="Expiration Date" DataIndex="ExpDate" Width="50" Format="MM/dd/yyyy"></ext:DateColumn>
                                            
                             
                              <ext:CommandColumn runat="server" Width="30" Header="Edit" >
                                   <Commands>   
                                                             
                                         <ext:GridCommand Icon="ApplicationFormEdit" CommandName="Edit" >
                                                             <ToolTip Text="Edit Offender details" />
                                                             
                                         </ext:GridCommand>
                                                                                      
                                   </Commands>                         
                           
                              </ext:CommandColumn>  
                                            </Columns>
                                        </ColumnModel>    
                                                            <DirectEvents>
                                <Command OnEvent="Command">                              
                                                    <EventMask ShowMask="true"> </EventMask>
                                                    
                                                        <ExtraParams>
                                                             <ext:Parameter Name="OffenderId" Value="record.data.OffenderId" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="OffenderNumber" Value="record.data.OffenderNumber" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="LayInMstrId" Value="record.data.LayInMstrId" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="LayInSplId" Value="record.data.LayInSplId" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="OffenderName" Value="record.data.OffenderName" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="Race" Value="record.data.Race" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="Wing" Value="record.data.Wing" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="Unit" Value="record.data.Unit" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="UnitLockId" Value="record.data.UnitLockId" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="SpecialtyMeal" Value="record.data.SpecialityMeal" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="SpecialtyMealId" Value="record.data.SpecialityMealId" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="ExpDate" Value="record.data.ExpDate" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="LayInFlag" Value="record.data.LayInFlag" Mode="Raw"></ext:Parameter>     
                                                             <ext:Parameter Name="command" Value="command" Mode="Raw" ></ext:Parameter>                                 
                                                        </ExtraParams>                             
                                          </Command>  
    
                        </DirectEvents>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="True" />
                            </SelectionModel>
                       
                            <LoadMask ShowMask="false" />
                           
                       <Listeners>
                                <CellClick Fn="cellClick" />
                            </Listeners> 
                        <Plugins>
                       <ext:GridPanelMaintainScrollPositionOnRefresh ID="GridPanelMaintainScrollPositionOnRefresh1" runat="server" ></ext:GridPanelMaintainScrollPositionOnRefresh>
                       </Plugins>          
                <BottomBar>
                     <ext:PagingToolbar ID="PagingToolbar1" HideRefresh="true" runat="server" PageSize="100" AutoWidth="True" DisplayMsg="Displaying {0} - {1} of {2}">
                        <Items>
                            <ext:Label runat="server" Text="Page size:" ID="ctl17" />
                            <ext:ToolbarSpacer runat="server" Width="10" ID="ctl19" />
                            <ext:ComboBox runat="server" Width="80" Editable="false" ID="ctl21" 
                                HiddenName="ctl00_ctl21_Value">
                                <Template runat="server" Visible="False" ID="ctl23" EnableViewState="False"></Template>
                                <Items>
                                    <ext:ListItem Text="10" />
                                    <ext:ListItem Text="50" />
                                    <ext:ListItem Text="100" />
                                    <ext:ListItem Text="500" />
                               </Items>
                                <SelectedItem Value="100" />
                                <Listeners>
                                    <Select Handler="#{PagingToolbar1}.pageSize = parseInt(this.getValue()); #{PagingToolbar1}.doLoad();" />
                                </Listeners>
                            </ext:ComboBox>
    
                        </Items>
                    </ext:PagingToolbar>
                </BottomBar>
                
    
                 <View>
                    <ext:GridView ForceFit="true" ID="ctl183" >
                     </ext:GridView>
                </View>
                         <DirectEvents>
                    <CellClick 
                        OnEvent="ShowDetails" 
                        Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
                        <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{gpData}.body}" />
                        <ExtraParams>
                            <ext:Parameter Name="id" Value="params[0].getStore().getAt(rowIndex).data['offenderNumber']" Mode="Raw" />
                        </ExtraParams>
                    </CellClick>
                    
                </DirectEvents> 
                </ext:GridPanel>
    
                    <uc1:Editor ID="Editor1" runat="server" />
    Last edited by Daniil; Dec 02, 2013 at 12:40 PM. Reason: Please use [CODE] tags
  4. #4
    I am afraid I cannot run it.
  5. #5
    Quote Originally Posted by Daniil View Post
    I am afraid I cannot run it.
    do you mean it is not possible or you can't run my code?
  6. #6
    Yes, I cannot run it.

    Is the user control really required to reproduce the issue?

    If no, please provide just a page.
  7. #7
    I am not sure what do you mean by "Is the user control really required to reproduce the issue?"


    Everything is in working order, customer is requesting to make a change to the gridview scroll bar.
    Here is what I am trying to accomplish:

    data is displayed in a gridview panel with the option to edit the data. Once the edit is clicked it opens up another window where the dates and check box can be selected. After the selection is made there is a save button and once the save is clicked it goes back to the original page but it also scrolls to top of the page. I need to maintain the scroll bar position.
  8. #8
    Well, I just need something to copy, paste, run and get it reproducible locally.

Similar Threads

  1. [CLOSED] GridPanel Refresh grid problem
    By John_Writers in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: May 23, 2013, 12:09 PM
  2. Replies: 7
    Last Post: Mar 27, 2013, 6:07 AM
  3. Replies: 2
    Last Post: Mar 27, 2013, 6:04 AM
  4. [CLOSED] Grid View Header Row Problem
    By mohan.bizbites in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 19, 2011, 7:17 AM
  5. Problem in Refresh button Of Grid Panel
    By Rakeshkumar.a in forum 1.x Help
    Replies: 1
    Last Post: Dec 14, 2010, 6:13 AM

Posting Permissions