sort by Kg Ordenar por Kg

sort by Kg Ordenar por Kg

silenssilens Posts: 101Questions: 40Answers: 0

Hola, me gustaría saber como puedo ordenar una columna tipo numero kg , 100 kg. Que tipo de plugin puedo usar. Muchas gracias

This question has accepted answers - jump to:

Answers

  • rf1234rf1234 Posts: 2,801Questions: 85Answers: 406
    Answer ✓

    Por favor, search for “formatted-num“ or take a look at some of my posts that deal with it. @ my mobile right now, can't post links, disculpe.

  • silenssilens Posts: 101Questions: 40Answers: 0

    No he conseguido solucionar le problema de ordenación con numero + Kg Alguién sabe como podría hacerlo? Gracias.

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @silens ,

    Eche un vistazo a este ejemplo, está dividiendo la cadena en la función de renderizado

    http://live.datatables.net/voboyera/1/edit

    Cheers,

    Colin

    p.s. gracias traducciones de google

  • silenssilens Posts: 101Questions: 40Answers: 0
    edited June 2018

    Muchas Gracias, @colin pero creo que no funciona bien,

    http://live.datatables.net/dinekosu/2/edit?html,css,js,output.

    Fijate que con esos pesos no hace el orden correcto.

    1º 66 Kg
    2º 2 Kg
    3 11 Kg

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    edited June 2018 Answer ✓
  • silenssilens Posts: 101Questions: 40Answers: 0
    edited June 2018

    Muchisimas Gracias, ha funcionado bien.

    Habría alguna forma de hacerlo en esta tabla

    var tablinAlb = '<table id="tbl_LinAlb" class="display responsive no-wrap" style="width:100%" ><thead><tr  HEIGHT="3">  <td  BGCOLOR="#7c979e" ><font color="white">Producto:</font></td></td><td  BGCOLOR="#7c979e" ><font color="white">Certificado:</font></td><td  BGCOLOR="#7c979e" class = "text-right"><font color="white">Bultos:</font></td><td  BGCOLOR="#7c979e" class = "text-right"><font color="white">Kilos:</font></td><td  BGCOLOR="#7c979e" class = "text-right"><font color="white">Precio:</font></td><td  BGCOLOR="#7c979e" class = "text-right"><font color="white">Importe:</font></td></tr>'
                + '</thead>' + '<tbody>';
                $.each(objJson, function (i, item) {
                    tablinAlb += '<tr  style="cursor: pointer;"> <td >' + objJson[i].name + '</td><td>' + objJson[i].cert + '</td><td class = "text-right">' + objJson[i].cnt + '</td><td class = "text-right">' + objJson[i].pso_net_real + '</td> <td class = "text-right">' + objJson[i].pre + '</td> <td class = "text-right">' + objJson[i].imp + '</td></tr>';
                });
                tablinAlb += '</tbody><tfoot><tr HEIGHT="3"> <td  BGCOLOR="#7c979e" class = "text-right"></td> <td  BGCOLOR="#7c979e" ></td><td  BGCOLOR="#7c979e" class = "text-right"></td> <td  BGCOLOR="#7c979e" class = "text-right" ></td> <td  BGCOLOR="#7c979e" class = "text-right"></td><td  BGCOLOR="#7c979e" class = "text-right"></td></tr></tfoot></table>' ;
    

    En este caso sería el campo objJson[i].pso_net_real.

This discussion has been closed.