1

I got some problems and dont know how to go on.

I got a few lines with information. Now I want to sort them after a click on their caption.

The lines look like this:

<article class="containerCol col=>1">
        <div class="divCell row=>1">1074</div>
        <div class="divCell row=>2">WE L0.1</div>
        <div class="divCell row=>3">2013-10-11</div>
        <div class="divCell row=>4">Constant1</div>
        <div class="divCell row=>5">Peter Lustig</div>
        <div class="divCell row=>6">asdf</div>
        <div class="divCell row=>7">12,34</div>
        <div class="divCell row=>8">1,123455</div>
        <div class="divCell row=>9">3</div>
        <div class="divCell row=>10">True</div>
        <div class="divCell row=>11"></div>
    </article>

If i click on the Caption of row=>8 I wanted to put all values of the container into an object with id of the line.

function sortHigh2Low(rowId) {
        var items = [];
        var i = 1;
        $(".divCell").each(function(){
            if($(this).hasClass("row=>" + rowId) && $(this).hasClass("caption") != true) {
                var element = {}; 
                element.id = i;
                element.value = $(this).html();
                items.push(element);
                i++;
            }
        });
        console.log(items);
    }

Now I got every object in my array but I dont know how to sort them. AND I dont know if the row got text or numbers as value.

I hope you could help me because I'm pretty sure I will go crazy in a few minutes.

Thanks a lot for your help.

Pablo Christiano
  • 365
  • 3
  • 21

0 Answers0