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.

I want to focus on particular cell on grid view

Thread ID:

Created:

Updated:

Platform:

Replies:

120015 Aug 24,2015 07:14 AM Aug 25,2015 05:45 AM JavaScript 1
loading
Tags: ejGrid
Bharat Buddhadev
Asked On August 24, 2015 07:14 AM

Waiting for your previous reply 


I want to use Technology must be Angular JS and MVC

while performing validation If I  am getting error I want to focus on first row and first column of grid of textbox which is open row

So here what i want is to put focus on first row and first cell of grid which is open cell of grid

Thank you waiting for you quick reply.







Madhu Sudhanan P [Syncfusion]
Replied On August 25, 2015 05:45 AM

Hi Bharat,

Thanks for using Syncfusion products.

Query: “while performing validation If I  am getting error I want to focus on first row and first column of grid of textbox which is open row”

We can achieve this requirement by registering a click event to the grid. Since the Jquery validation will perform out of box of the grid, we need to set the focus to the first element in the click handler registered, when the validation failed.

Please refer the below truncated code example.


<div id="grid" ej-grid e-datasource="data" . . . .  e-create="onCreate">

        . . . .
</div>

angular.module("SampleApp", ["ejangular"])

            .controller("SampleController", function ($scope) {

                . . . .

               $scope.onCreate = function () {


                     this.element.on("click.ejgrid", ".e-rowcell,.e-tooltxt", ej.proxy(function (e) {


                        //Check for edit state and prevent click on edit element.

                        if (this.model.isEdit && $(e.currentTarget).closest("form").length == 0) {

                            $("#gridEditForm input")[0].focus();

                        }


                    }, this));


                };
            });


For your convenience we have created a grid sample with above code and the same can be referred from the below link.

http://jsplayground.syncfusion.com/oeyk3xqr

Please let us know if you have any query.

Regards,
Madhu Sudhanan. P

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.

;