Git Product home page Git Product logo

Comments (14)

tabalinas avatar tabalinas commented on July 21, 2024 2

BTW multiple row header is already possible to implement with headerRowRenderer:

    headerRowRenderer: function() {
        var $result = $("<tr>").height(0)
            .append($("<th>").width(200))
            .append($("<th>").width(300));

        $result = $result.add($("<tr>")
            .append($("<th>").attr("colspan", 2).text("Name")))

        return $result.add($("<tr>")
            .append($("<th>").width(200).text("First Name"))
            .append($("<th>").width(300).text("Last Name")));
    }

See the fiddle:
http://jsfiddle.net/tabalinas/k9935wn3/

from jsgrid.

llopez91 avatar llopez91 commented on July 21, 2024 2

I have a question, does anyone know how to add rowspan to the rows of my table? Not to the header, if not to the rows, so that it has for years grouped a value and appears the combined cell.

Like this in the row 13 and 14
captura

from jsgrid.

tabalinas avatar tabalinas commented on July 21, 2024

Thank you for the valuable request!

from jsgrid.

CrazyRedScorp avatar CrazyRedScorp commented on July 21, 2024

Thank you, and sorry - but does not work sorting by columns.

from jsgrid.

tabalinas avatar tabalinas commented on July 21, 2024

You are right, in this case you have to call sort yourself. Like in the following fiddle http://jsfiddle.net/tabalinas/k9935wn3/3/

from jsgrid.

CrazyRedScorp avatar CrazyRedScorp commented on July 21, 2024

Thank you!!!

from jsgrid.

CrazyRedScorp avatar CrazyRedScorp commented on July 21, 2024

And again. Please see special case - http://jsfiddle.net/RedScorp/3q24e6fn/1/
Your example: full working.
My example: column "date" and "contacts" without sorting. I do not understand - how to add the right conditions.

from jsgrid.

tabalinas avatar tabalinas commented on July 21, 2024

It doesn't work in your case because you don't attach click handlers on <th> with rowspan.
Just attach click handlers on all <th> elements.

$("<th>").attr("rowspan", 2).text("Id").on("click", function() { grid.sort(index); });

from jsgrid.

CrazyRedScorp avatar CrazyRedScorp commented on July 21, 2024

Good morning.
I have added your line in "append" and received an error - variable "index" is not found.
Hmmm. Okey, I added index manually, and - It worked!

http://jsfiddle.net/RedScorp/3q24e6fn/3/

$result = $result.add($("<tr>")
  .append($("<th>").attr("rowspan", 2).text("Id").on("click", function() { grid.sort(0); }))
  .append($("<th>").attr("rowspan", 2).text("Date").on("click", function() { grid.sort(1); }))
  .append($("<th>").attr("colspan", 2).text("FullName"))
  .append($("<th>").attr("colspan", 2).text("ColAB"))
  .append($("<th>").attr("rowspan", 2).text("Contacts").on("click", function() { grid.sort(6); }))
);

Thank you! Thanks for your work!

from jsgrid.

CrazyRedScorp avatar CrazyRedScorp commented on July 21, 2024

And the next question: "sortDescClass" (.jsgrid-header-sort .jsgrid-header-sort-asc .jsgrid-header-sort-desc) is used for the first in a row, with a height of (0). How to move the class to the second row?
For example: http://jsfiddle.net/RedScorp/3e1vvhvb/1/
Thanks.

from jsgrid.

tabalinas avatar tabalinas commented on July 21, 2024

Good question. As this scenario is not build-in, you have to put a workaround:

Add _setSortingCss to the grid config:

    _setSortingCss: function() {
        var fieldIndex = $.inArray(this._sortField, this.fields); // this is how you know the sorting field index

        // add css class to the header cell. You can identify it by fieldIndex.
        $yourHeaderCell.addClass(this._sortOrder === "asc" ? this.sortAscClass : this.sortDescClass);
    },

To get access to the $yourHeaderCell save $header rows that you create in headerRowRenderer to this (in current case this is a grid).

from jsgrid.

tabalinas avatar tabalinas commented on July 21, 2024

@llopez91, this can be achieve with rowRenderer.

from jsgrid.

llopez91 avatar llopez91 commented on July 21, 2024

Hi tabalinas, can you show me how to do?, Thanks :)

from jsgrid.

buckelieg avatar buckelieg commented on July 21, 2024

This should be implemented as model configuration in the grid.
Thanx for this awesome grid!

from jsgrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.