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

Multiple pivot tables on a page #22

Open
shelly-skeens opened this issue Aug 26, 2013 · 8 comments
Open

Multiple pivot tables on a page #22

shelly-skeens opened this issue Aug 26, 2013 · 8 comments

Comments

@shelly-skeens
Copy link

Any suggestions on going about getting pivot.js to work with multiple tables on a single page? I've created a new setup option in order pass in a unique html div id (and also create unique sub-elements). Everything loads correctly with multiple tables, but I'm having problems with row and column filtering and scope. The fields array in pivot.config() shows all the fields in all the tables, for instance.

This is a great plugin, by the way!

@alexhgreen07
Copy link
Contributor

I'd also like to see this feature included in this library. A few ideas on how to go about this are below:

  • Encapsulate all pivot variables in a 'class like' function.
function pivot(initialization_arguments)
{
        //initialize variables

        this.function1 = function(args)
        {
                //...code
        }

        this.function2 = function(args)
        {
                //...code
        }
}
  • Move all pivot functions to class.
  • Create a new instance of the function object with the 'new' operator.
var pivot_table1 = new pivot(pivot1_arguments);
var pivot_table2 = new pivot(pivot2_arguments);
  • This should also include the jquery plug-in, where each 'div' that has 'jquery_pivot' called on it creates its own instance of the 'pivot' class.

If this feature is valuable to other users I can attempt to implement something.

@shelly-skeens
Copy link
Author

Thank you for the pointers. I use jquery quite a bit but I've never authored a plugin. I may try to do something as I get time, since this library has been quite useful.

Needless to say, I would definitely find it valuable if you were to implement something!

@vijay777pawar
Copy link

Yes , alexhgreen07 I tried Creating New Instance ..Dosen't Works .... It Is Some Thing Less In This Library..... It Needs multiple Instance functionality......

Multiple Datatable On Single Page Works.
But,
Multiple Only Pivot On Dosen't Works.
After integration,
Multiple (Datatable + OnlyPivot) Also On Dosen't Works.

@JonForest
Copy link

I've written some code to support multiple reports on a single page in our product. As mentioned already, it basically involves changing pivot.js and jquery-pivot.js to be instantiatable objects rather than singletons, plus a few other tweaks to support this. I'm thinking of putting in a PR for the work when I get some time, do you think there would be any interest?
Unfortunately, it is impossible to do and not break existing implementations. (I think)

@rwjblue
Copy link
Owner

rwjblue commented May 18, 2014

Sounds interesting to me.

@JonForest
Copy link

Cool. Well, I'm away from a keyboard for three weeks, but once I'm back I'll try and work on this in my downtime.

@rwjblue
Copy link
Owner

rwjblue commented May 18, 2014

Sweet. Thanks!

@shelly-skeens
Copy link
Author

I haven't used Pivot for the last few months, but I for one would love to see this happen, JonForest. This plugin has been incredibly useful!

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

5 participants