javascript - How to highlight the currently selected column using Ember? -


Amber comes with the built-in support for arrange arrays in controllers, which is very useful in updating the template when the data is sorted It makes the order varies.

My question is, how easily (1) the data has been sorted and (2) sort order (ascending or descending) highlight the currently selected column. By highlighting, I mean adding up or down arrows, or something similar.

At the moment, I'm unhappy with the use of jQuery in the scene layer, but I think the solution is simple solution, as amber handles small problems like this.

For the table, I would recommend using this, it is a powerful library and you have something with amber Can be used without worrying about

In my case I have a function where I have given table ID, headers, and data multi-dimensional array. / P> setDataTable (TableID, header, data, elementToOrder, typeOrder, index, value, displayLength, pagination, applyclass, callback) {if (TableID == null = header == null || data == faucet) return; Var table = $ ('#' + Table ID); Var table element = document.getElementById (tableId); If return (tableElement == blank); If ($ .fn.DataTable.fnIsDataTable (tableElement)) table.dataTable () FnDestroy (); If (elementToOrder == empty) elementToOrder = 0; If (typeOrder == null) typeOrder = "desc"; If (displayLength === faucet) displayLength = "10"; If (pagg == zero) paged = true; Table.dataTable ({"sDom": "& lt; 'line no side margin' & lt; 'name-left'l & gt; & lt;' name- rigth'f & gt; ra & gt; t & lt ; 'Row no side margin' & lt; 'name-left'i & gt; & lt;' name-rigth'p & gt; "," sPaginationType ":" bootstrap "," oLanguage ": {" sLengthMenu ":" _ MENU_ iTENS knuckles page "," sSearch ":" Pesquisar: "," sInfo ":" Mostrando _START_ a _END_ D _TOTAL_ linhas "," sInfoEmpty ":" Unable to Existem Linhas para mostrar "," sEmptyTable " : "Nao Ha Dados disponíveis na tabela", "oPaginate": { "sNext": "Next", "sPrevious": "anterior"}}, "fnDrawCallback": function (oSettings) {if (callback == nULL) return ; Window.setTimeout (Callback, 100);}, "iDisplayLength": DisplayLength, "Isorting": [[Elementtood , Taipordr]], "Biprosesing": true, "B Difrrender": true, "Beepignet" Pejanet, "Aadet a" data, "AoColumns" header, "FnRowCallback" function (Nrow, AData, iDisplayIndex , IDisplayIndexFull) {If (index == faucet) return; if (! Applicable class) return; if (adata [index] === value) $ (nro). Adclass ("danger"); And $ (NRO). Adclass ("success"); }}); Table.removeAttr ('style'); }

For example, imagine that you have a table like this in HTML:

   

They have a title like me:

  var PhoneHeader = [{"sTitle": "state"}, {"sTitle": "# Phone "}, {" sTitle ":" #client "}];  

And in the end, like a multi-dimensional array:

  var myArray = []; MyArray.pushObject (["OK", "4455522", "221334"]); MyArray.pushObject (["Not OK", "4455522", "221334"]);  

them I'll call your function:

  Setdetatebl ( "Fonitemstabl" Fonhader, Mayare);  

Other parameters are for optimizing the table.

I hope this can help you


Comments