Giter VIP home page Giter VIP logo

Comments (8)

nshah31 avatar nshah31 commented on August 24, 2024 1

To remove columns i am using this

$(o).find("tr").not(e.settings.exclude).each(function (i, o) { var cloneRow = $(o).clone(); $(cloneRow).find(e.settings.exclude).remove(); var html = $(cloneRow).html(); tempRows += "<tr>" + html + "</tr>"; });

from jquery-table2excel.

ferman2147 avatar ferman2147 commented on August 24, 2024

Any tr tag you add class=".noExl" will be excluded. I haven't tried it for th though, why don't you try and see if it works?

from jquery-table2excel.

rainabba avatar rainabba commented on August 24, 2024

col and col group were deprecated in HTML 4.01 and the reality is there aren't "columns" in an html table which makes manipulating them very tricky.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup

As ferman2147 suggested, the plugin already supports row exclusion using the .noExl class. It wouldn't be hard to add individual cell exclusion and then it would be up to you to ensure all the cells in a "column" were marked and then you could implicitly exclude them.

TODO: Add individual cell exclusion using .noExl

from jquery-table2excel.

Jevuska avatar Jevuska commented on August 24, 2024

ya @ferman2147 , i've try before but no luck, and @rainabba I add individual cell exclusion using .noExl in the same column not work too, so I create another code outside like this one to remove a column.

$('table').delegate('td,th', 'click', function() {
 var index = this.cellIndex;
  $(this).closest('table').find('tr').each(function() {
   this.removeChild(this.cells[ index ]);
  });
 });

any suggestion how to include in this plugin?

from jquery-table2excel.

ferman2147 avatar ferman2147 commented on August 24, 2024

What you need to do is pretty simple. Here is a screenshot for you. Note that you should give the id attribute to your table like < table id="myTable". (Looking at the the screenshot I realised that I forgot to do so.;) )
adsiz

from jquery-table2excel.

jaydeepgiri avatar jaydeepgiri commented on August 24, 2024

Thanks https://github.com/nshah31 (nshah31)..

Above Solution works perfectly when we comment the following code and add above code in jquery.table2excel.js -->>

// $(o).find("tr").not(e.settings.exclude).each(function (i,o) {
    // tempRows += "<tr>" + $(o).html() + "</tr>";
// });

Thank you once again

from jquery-table2excel.

Kalemstorm94 avatar Kalemstorm94 commented on August 24, 2024

Can you explain me please what have you done? I've added nshah31's code and i've commented the one you mentioned, but when i try to add the noExl class to a or element, it's still not working...

from jquery-table2excel.

jaydeepgiri avatar jaydeepgiri commented on August 24, 2024

@Kalemstorm94 on line #54 or near by you would find following code

$(o).find("tr").not(e.settings.exclude).each(function (i,o) {
     tempRows += "<tr>" + $(o).html() + "</tr>";
}); //comment this code

and just after this add this following code

//To Exclude the columns
$(o).find("tr").not(e.settings.exclude).each(function (i, o) { var cloneRow = $(o).clone(); $(cloneRow).find(e.settings.exclude).remove(); var html = $(cloneRow).html(); tempRows += "<tr>" + html + "</tr>"; });
e.tableRows.push(tempRows);

That's it it will work fine.
Hope this helps

from jquery-table2excel.

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.