开发者

jquery filter data from json similar to Excel pivot table

开发者 https://www.devze.com 2023-04-10 01:38 出处:网络
I have created a complex pivot table in Excel and I want to do the same thing in jquery. I have converted the data to Json. I have been able to find examples of accessing the data and of using the for

I have created a complex pivot table in Excel and I want to do the same thing in jquery. I have converted the data to Json. I have been able to find examples of accessing the data and of using the formulas but I can't find examples of using drop-down menus similar to the Escel filtering method.

For instance, I have five different options (City, Bedrooms, Baths, Garage, Foreclosure) and the user is able to make a choice or leave the filte开发者_JS百科r alone. Based on the users choices only specific data will be used for the formulas. If they choose a City and 2 bedrooms all the relevant data will be used in the formulas.

Any suggestions on where I can find examples of doing this type of filtering in jquery with dropdowns?


I know, it's late for the OP but I ran into a similar requirement and found a plugin that does exactly what you are asking for, it let's the user "drag and drop" dimensions, "dropdown filtering", several render modes (including charts and heat map).

Also you can check out the code, it is written in coffeescript, you can find it all here: https://github.com/nicolaskruchten/pivottable


You could look at existing jQuery plugins that do pivot table stuff. This one looks good:

http://metalogic.dk/jquery.pivot/demo.htm

Although I guess it doesn't use dropdowns in the way you were imagining.

For filtering, you should filter the data yourself before pivoting using the above mentioned plugin. For this you can use jQuery's grep method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号