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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

clearSelection after rowselected

Thread ID:

Created:

Updated:

Platform:

Replies:

145536 Jun 27,2019 02:46 AM UTC Jun 27,2019 11:36 AM UTC JavaScript - EJ 2 1
loading
Tags: Grid
Kenneth Tang
Asked On June 27, 2019 02:46 AM UTC

Dear all,

We try to add grid with javascript as follow :

ej.grids.Grid.Inject(ej.grids.Page, ej.grids.Sort, ej.grids.Filter);

                grid = new ej.grids.Grid({

                    dataSource: ListArr,

                    columns: [

                        { field: 'Id', headerText: 'Camera ID', width: 120, type: 'string',visible:false },

                        { field: 'Name', width: 140, headerText: 'Camera Name', type: 'string' }

                    ],

                    toolbar: ['Search'],

                    allowSorting: true,

                    allowPaging: true,

                    pageSettings: { pageSize: 20 },

                    rowSelected: rowSelected

                });


                grid.appendTo('#Grid');


        function rowSelected(args) {


                var selectedIndex = $.map(ListArr, function (item, index) {

                    return item.Id;

                }).indexOf(args.data.Id);


            if (currContainer === "") {

                alert("error");

                grid.clearSelection();

            }

            else

                buildCameraElement(cameraArr[selectedIndex]);

        }


After display the alert message, we fail to clear the selected highlight row. Please advance, thx.

KennethT 

Pavithra Subramaniyam [Syncfusion]
Replied On June 27, 2019 11:36 AM UTC

Hi Kenneth, 
 
Thanks for contacting Syncfusion support. 
 
You can achieve the clear selection inside the rowSelected event as below. Please refer to the below code example and sample link for more information. 
 
[index.js] 
var data = new ej.data.DataManager(window.orderData).executeLocal(new ej.data.Query().take(15)); 
      grid = new ej.grids.Grid({ 
           dataSource: data, 
           columns: [ 
              { field: 'OrderID', headerText: 'Camera ID', width: 120, type: 'string',visible:false }, 
              { field: 'CustomerID', width: 140, headerText: 'Camera Name', type: 'string' } 
                     ], 
            pageSettings: { pageSize: 20 },      
            rowSelected: rowSelected 
             }); 
      grid.appendTo('#Grid'); 
       function rowSelected(args) {        
            if (args.data.OrderID === 10248) { 
                alert("error"); 
                setTimeout((e)=>{ 
                  grid.clearSelection() 
                  }) 
            } 
       } 
 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon