2861

Make Command Button invisible in Kendo Grid

Question:

I am new to kendo UI. In my code, columns are getting created as shown below.

grid = $('#grid').kendoGrid({ columns: [ { width: 75, command: [{ name: "Tag", click: function (e) { try { } catch (ex) { alert(ex.message); } } }] }, { field: "Col18", title: "IsTag", width: 75 }, { field: "Col8", title: "System", width: 75 }, ],

Now, in the databound, based on the value from datasource, they are changing the color of the row as show below. My issue is, if the color is green, I want to hide the command button. How can I achieve this.

dataBound: function () { dataView = this.dataSource.view(); for (var i = 0; i < dataView.length; i++) { var obj = $("#grid tbody").find("tr[data-uid=" + dataView[i].uid + "]"); switch (dataView[i].Aklr) { case "R": obj.addClass("red"); break; case "R+": obj.addClass("darkred"); break; case "G": obj.addClass("green"); break; } } }

Answer1:

Since you have already added a class to your table row you can accomplish this with CSS.

<a href="http://jsbin.com/fogulena/3/edit?html,css,js,output" rel="nofollow">http://jsbin.com/fogulena/3/edit?html,css,js,output</a>

.green .k-grid-Tag { display: none; }

Answer2:

Here, I find the answer.

$("#grid tbody").find("tr[data-uid=" + dataView[i].uid + "] td:eq(0)").html("");

Recommend

  • Transforming a CSV from wide to long format
  • TQSL to reformat records with duplicate data into one record [closed]
  • How to transpose one or more column pairs to the matching record in Excel?
  • DataGridView data-bound to a list is not updated
  • merge cells in gridview that has same value in asp.net
  • How to show picture that is stored in SQL Server database using ASP.NET?
  • Unable to style borders of a row of Kendo grid
  • Is is safe to use HSQLDB for production? (JBoss AS5.1)
  • Is there a way to disable a specific event in kendo ui scheduler?
  • Primefaces lazy datascroller calling load twice
  • LESS CSS how to modify parent property in mixin
  • Click on button in another program - FindWindow, C#
  • Flash radiobutton: how do I get the selected radiobutton?
  • How to access meteor package name inside package?
  • Rest Services conventions
  • jQuery: How to AJAXify WordPress Search?
  • SonarQube: Cannot deactivate rule with missing quality profile
  • Selenium to click on a javascript button corresponding to a text
  • Button click event not firing in jQuery
  • How do I superscript characters in a UIButton?
  • onBackPressed() not being executed
  • Word Open XML Mail Merge
  • Use of this Javascript
  • How do I alternate colors in Flat List (React Native)
  • Android fill_parent issue
  • C++ Partial template specialization - design simplification
  • Display issues when we change from one jquery mobile page to another in firefox
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • To display the title for the current loaction in map in iphone
  • jquery mobile loadPage not working
  • How to get next/previous record number?
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Python: how to group similar lists together in a list of lists?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • trying to dynamically update Highchart column chart but series undefined
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Android Google Maps API OnLocationChanged only called once
  • How does Linux kernel interrupt the application?