Sortable tables with non existing value but different attributes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sortable tables with non existing value but different attributes

Victor Martinez

Hi there,

Any ideas how I can use the sortable type in a non value cell? I though I could use the "data-sort" attribute in the cell but it doesn't work.

As you can see below, there is a table based on two columns, first column contains the value "${job.name}" while the second column is just a colorful cell

<table class="sortable pane bigtable" id="lintTable">
    <thead>
      <tr>
          <th class="pane-header">Job Name</th>
          <th class="pane-header">Status</th>          
      </tr>
    </thead>
    <tbody id="lintBody">
        <j:forEach var="job" items="${it.jobSet.elements()}">
            <tr>
            <td>${job.name}</td>
            <td id="${job.defect. status}" style="background-color: ${job.defect.color?;"/>          
        </j:forEach>
   </tbody>
</table>

And its UI


I wish I could also order the Status column based on the colors but it seems the only sortable field is the value one: https://github.com/jenkinsci/jenkins/blob/master/war/src/main/webapp/scripts/sortable.js#L241

Any ideas whether the sortable class can be used with hidden values or different cell attributes?

Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5899e2b8-d025-46a2-9a67-5df566aebb75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sortable tables with non existing value but different attributes

Antonio Muñiz
I don't see clean way to do it.
Best I can think of is to write your own JS event so it requests the values with a specific sort to the backend.

On Tue, Aug 1, 2017 at 10:52 AM, Victor Martinez <[hidden email]> wrote:

Hi there,

Any ideas how I can use the sortable type in a non value cell? I though I could use the "data-sort" attribute in the cell but it doesn't work.

As you can see below, there is a table based on two columns, first column contains the value "${job.name}" while the second column is just a colorful cell

<table class="sortable pane bigtable" id="lintTable">
    <thead>
      <tr>
          <th class="pane-header">Job Name</th>
          <th class="pane-header">Status</th>          
      </tr>
    </thead>
    <tbody id="lintBody">
        <j:forEach var="job" items="${it.jobSet.elements()}">
            <tr>
            <td>${job.name}</td>
            <td id="${job.defect. status}" style="background-color: ${job.defect.color?;"/>          
        </j:forEach>
   </tbody>
</table>

And its UI


I wish I could also order the Status column based on the colors but it seems the only sortable field is the value one: https://github.com/jenkinsci/jenkins/blob/master/war/src/main/webapp/scripts/sortable.js#L241

Any ideas whether the sortable class can be used with hidden values or different cell attributes?

Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5899e2b8-d025-46a2-9a67-5df566aebb75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Antonio Muñiz
Software Engineer
CloudBees, Inc.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAJc7kzSqZavtM7s2X-wmS%2BqCJYa%2BK%2B-tAp47t1EaKXsw-ihvkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sortable tables with non existing value but different attributes

stephenconnolly
In reply to this post by Victor Martinez
Isn't it just a question of using the <td data="..."> attribute to have sorting on that attribute?

On 1 August 2017 at 01:52, Victor Martinez <[hidden email]> wrote:

Hi there,

Any ideas how I can use the sortable type in a non value cell? I though I could use the "data-sort" attribute in the cell but it doesn't work.

As you can see below, there is a table based on two columns, first column contains the value "${job.name}" while the second column is just a colorful cell

<table class="sortable pane bigtable" id="lintTable">
    <thead>
      <tr>
          <th class="pane-header">Job Name</th>
          <th class="pane-header">Status</th>          
      </tr>
    </thead>
    <tbody id="lintBody">
        <j:forEach var="job" items="${it.jobSet.elements()}">
            <tr>
            <td>${job.name}</td>
            <td id="${job.defect. status}" style="background-color: ${job.defect.color?;"/>          
        </j:forEach>
   </tbody>
</table>

And its UI


I wish I could also order the Status column based on the colors but it seems the only sortable field is the value one: https://github.com/jenkinsci/jenkins/blob/master/war/src/main/webapp/scripts/sortable.js#L241

Any ideas whether the sortable class can be used with hidden values or different cell attributes?

Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5899e2b8-d025-46a2-9a67-5df566aebb75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMwqGVTRcwJQ64nGx%3D89KAPD%3DqVAOSRLCoB3S%3DKuBEUQpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sortable tables with non existing value but different attributes

Victor Martinez
indeed!! It works like a charm

Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/bbc07e0a-c5f0-4a75-b609-db7bbf6efa56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sortable tables with non existing value but different attributes

Antonio Muñiz
Oh, I thought you already tried that :)

El El mar, 1 ago 2017 a las 15:49, Victor Martinez <[hidden email]> escribió:
indeed!! It works like a charm

Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/bbc07e0a-c5f0-4a75-b609-db7bbf6efa56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Antonio Muñiz
Software Engineer
CloudBees, Inc.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAJc7kzSF5hVazjtV64KMEmEm%2Bch_WoYBH0_%3D1Q9HvCNk0fi%3DGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...