Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXCLUDE doesn't need to be whole row Feature (with simple code change) #40

Closed
SeanDevoy opened this issue Jun 2, 2016 · 3 comments
Closed

Comments

@SeanDevoy
Copy link
Contributor

SeanDevoy commented Jun 2, 2016

FYI: I love this add-in!

Currently, the "exclude" filter only ignores complete s (rows) with the matching class on them. I had a need to export a table and NOT export "controls" like Buttons and dropbox items into the spreadsheet.

With a very simple change to the code, individual s can have there content ignored. Code does not display well here, but the idea is simple. Step through the item's s. If the contains something with the exclude class, send an empty , otherwise send its contents. There is probably a cleaner way to do this, jQuery tips will be welcomed.

I changed:
// get contents of table except for exclude $(e.element).each( function(i,o) { var tempRows = ""; $(o).find("tr").not(e.settings.exclude).each(function (i,o) { tempRows += "<tr>" + $(o).html() + "</tr>"; }); e.tableRows.push(tempRows); });

to:
`
// get contents of table except for exclude
$(e.element).each( function(i,o) {
var tempRows = "";
$(o).find("tr").not(e.settings.exclude).each(function (i,p) {
tempRows += "";
$(p).find("td").not(e.settings.exclude).each(function (i,q) {
var flag = $(q).find(e.settings.exclude) // does this have an exclude item
if(flag.length >= 1) {
tempRows += " " // exclude it!!
} else {
tempRows += "" + $(q).html() + ""
}
})

                tempRows += "</tr>";
            });
            e.tableRows.push(tempRows);
        });

`
Now I my "controls" are excluded from the spreadsheet.

Hope that helps someone out.
Sean

@rainabba
Copy link
Owner

rainabba commented Jun 2, 2016

Thanks @SeanDevoy . If you know how to submit a PR, go for it and get the contribution! :) If not, just fork the repo, make the change, the find the "Submit Pull Request" button and it should be clear where to go from there. You can even make the change right in the web interface in your repo so you don't need to leave the browser.

@SeanDevoy
Copy link
Contributor Author

Did I do it correctly? Am I supposed to [cid:image001.png@01D1BD7F.4F390C10] ?

From: rainabba [mailto:notifications@github.com]
Sent: Thursday, June 02, 2016 3:55 PM
To: rainabba/jquery-table2excel jquery-table2excel@noreply.github.com
Cc: Sean Devoy sdevoy@bizfocused.com; Mention mention@noreply.github.com
Subject: Re: [rainabba/jquery-table2excel] EXCLUDE doesn't need to be whole row Feature (with simple code change) (#40)

Thanks @SeanDevoyhttps://github.com/SeanDevoy . If you know how to submit a PR, go for it and get the contribution! :) If not, just fork the repo, make the change, the find the "Submit Pull Request" button and it should be clear where to go from there. You can even make the change right in the web interface in your repo so you don't need to leave the browser.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com//issues/40#issuecomment-223403398, or mute the threadhttps://github.com/notifications/unsubscribe/ABO44TJFA1rWkhypcASx5U0484TE4S5tks5qHzUogaJpZM4IsvWI.

@rainabba
Copy link
Owner

rainabba commented Jun 3, 2016

You did it correctly and have now officially contributed to another repo :) Thanks for the help.

@rainabba rainabba closed this as completed Jun 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants