We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Select row through javascript

Thread ID:

Created:

Updated:

Platform:

Replies:

126062 Sep 21,2016 05:34 AM Sep 22,2016 03:35 AM ASP.NET Web Forms 1
loading
Tags: Grid
Mirza Cavlicekic
Asked On September 21, 2016 05:34 AM

I have got a function that selects a row and then move scrolled to show it. Moving scroller is working fine, but selecting row it is not working.  How can I select row in grid on client side?

My function looks like this:

        function rowSelect_Show() {
            var obj = $("#Grid1").ejGrid("instance");
            var rowHeight = obj.getRowHeight();
            var selectedRowIndex = 12;
            obj.getScrollObject().scrollY(rowHeight * selectedRowIndex);
            obj.model.selectedRowIndex = selectedRowIndex;
            var objDt = $("#Grid1").data("ejGrid");
            objDt.selectedRowsIndexes.push(selectedRowIndex);
        }

Prasanna Kumar Viswanathan [Syncfusion]
Replied On September 22, 2016 03:35 AM

Hi Mirza, 

Thanks for contacting Syncfusion support. 

To select a row in the grid, use selectRows method of ejGrid.  

Find the code example and sample: 


<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowScrolling="true"> 
        <ScrollSettings Height="300" Width="500" ></ScrollSettings> 
        <Columns> 
                ---------------------------------- 
            </Columns> 
        <ClientSideEvents Create="create" /> 
        </ej:Grid>  
 
<script> 
    function create(args) { 
        var obj = $('#<%= Grid.ClientID %>').data("ejGrid"); 
        var rowHeight = obj.getRowHeight(); 
        var selectedRowIndex = 11; 
        obj.getScrollObject().scrollY(rowHeight * selectedRowIndex); 
        obj.selectRows(selectedRowIndex); 
    } 
</script> 


Refer to the Help document for the selectRows method.  


Regards, 
Prasanna Kumar N.S.V 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;