ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Disable ng-grid row selection based on column value in AngularJS<p>Hi&nbsp;rani,</p> <p>You can return false from <strong>beforeSelectionChange</strong> to disable selection of row on the grid based on the column value.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;Disable ng-grid row selection&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://code.jquery.com/jquery-2.2.3.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.min.js&#34;&gt;&lt;/script&gt; &lt;link rel=&#34;stylesheet&#34; href=&#34;//cdn.rawgit.com/angular-ui/ng-grid/v2.0.14/ng-grid.css&#34; /&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;//cdn.rawgit.com/angular-ui/ng-grid/v2.0.14/build/ng-grid.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#39;MyApp&#39;, [&#39;ngGrid&#39;]); app.controller(&#39;MyController&#39;, function ($scope) { $scope.Employees = [ { Id: 1, Name: &#39;Nancy Davolio&#39;, City: &#39;Seattle&#39;, Country: &#39;USA&#39; }, { Id: 2, Name: &#39;Andrew Fuller&#39;, City: &#39;Tacoma&#39;, Country: &#39;USA&#39; }, { Id: 3, Name: &#39;Janet Leverling&#39;, City: &#39;Kirkland&#39;, Country: &#39;USA&#39; }, { Id: 4, Name: &#39;Margaret Peacock&#39;, City: &#39;Redmond&#39;, Country: &#39;USA&#39; }, { Id: 5, Name: &#39;Steven Buchanan&#39;, City: &#39;London&#39;, Country: &#39;UK&#39; }, { Id: 6, Name: &#39;Michael Suyama&#39;, City: &#39;London&#39;, Country: &#39;UK&#39; }, { Id: 7, Name: &#39;Robert King&#39;, City: &#39;London&#39;, Country: &#39;UK&#39; }, { Id: 8, Name: &#39;Laura Callahan&#39;, City: &#39;Seattle&#39;, Country: &#39;USA&#39; }, { Id: 9, Name: &#39;Anne Dodsworth&#39;, City: &#39;London&#39;, Country: &#39;UK&#39; } ]; $scope.GridOptions = { data: &#39;Employees&#39;, enablePinning: false, multiSelect: false, beforeSelectionChange: function (row) { alert(&#34;Row Index : &#34; + row.rowIndex) if (row instanceof Array) { return row; } else { if (row.entity != undefined &amp;&amp; row.entity.Country == &#39;UK&#39;) { return false; } else { return true; } } }, columnDefs: [{ field: &#34;Id&#34;, width: 50, sortable: false, enableCellEdit: false }, { field: &#34;Name&#34;, width: 150, sortable: true, enableCellEdit: false }, { field: &#34;City&#34;, width: 100, sortable: true, enableCellEdit: false }, { field: &#34;Country&#34;, width: 100, sortable: true, enableCellEdit: false}] }; }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div ng-app=&#34;MyApp&#34; ng-controller=&#34;MyController&#34;&gt; &lt;div ng-grid=&#34;GridOptions&#34; style=&#34;width: 400px; height: 500px&#34;&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/952682/Disable-ng-grid-row-selection-based-on-column-value-in-AngularJS/https://www.aspforums.net:443/Threads/952682/Disable-ng-grid-row-selection-based-on-column-value-in-AngularJS/Wed, 31 Jul 2019 03:37:48 GMT