Wednesday 15 July 2015

c# - How to do foreach Row in table (DataTables API)? -


I am using in my .cshtml page.

From my work and I also have some actions for example:

  $ ("# grid_grid tbody"). ("Dblclick", "tr", function () {var dtApi = new $ .fn.dataTable.Api ("#Grid_grid") var card = dtApi.row (this) .data (); var uri = ActionResolver .GetActionUri ("edit", card); document.location = uri;});  

I need to talk one more time when the page is full, then I need to change the color for several lines (according to one stored value).

I have been able to regenerate it for the click action (just to see how to see it):

But I failed to do the same like this:

  $ ("# grid_grid tbody"). 'Tr'). Each (function () {var dtApi = new $ .fn.dataTable.Api ("# Grid_grid") var var = dtApi.row (this) .data (); if (val.Status == "cancellation") {$ (This). Children ('TD, V'). CSS ('background-color', '# FF0000');}});  

There is no response.

Is tired to use, but as a result

What am I missing and what am I doing wrong?

Update:

I have a specific table shown, so I think that before any script is run it has already begun Went. I have it in .cshtml:

  & lt; Div id = "cardgridcontenter" style = "margin: 10px; background-color: white;" & Gt; @html.action ("cardgred", "card") & lt; / Div & gt;  

In this controller:

  return grid ("Home Card", blank, empty);  

And this home. Card In the config file:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Grid & gt; & Lt; Field name = "order id" header = "order id" hidden = "true" /> & Lt; Field name = "no order" header = "order number" width = "100" asynchronous = "true" /> & Lt; Field name = "status" header = "position" incompatible = "true" redundant = "true" /> & Lt; Field Name = "Specification" Header = "Specification" /> & Lt; Field name = "date" required "header =" required date "type =" date "width =" 120 "format =" d "/> field; field name =" canceled status "header =" cancel The condition "width =" 100 "asynchronous =" true "/> & lt; DataUrl & gt; API / data / structure / cardviews & lt; / dataUrl & gt; & lt; queryfileter; order id 0 L  

How about using callbacks of data tabs? This way something like

  function table loaded ($ {"(example" example "). ('Tr'). Each (function () {$ (this) .Css ('background-color', '# FFA 000');}); } $ (Document) .ready (function () {var oTable = $ ('# example'). DataTable ({"initComplete": tableLoaded});});  

a simple


No comments:

Post a Comment