{"id":19091669,"url":"https://github.com/nikitaeverywhere/lightpivottable","last_synced_at":"2025-04-30T11:50:37.686Z","repository":{"id":22744354,"uuid":"26089515","full_name":"nikitaeverywhere/LightPivotTable","owner":"nikitaeverywhere","description":"Lightweight pivot table representation for MDX2JSON source for InterSystems Cache","archived":false,"fork":false,"pushed_at":"2022-11-11T22:29:21.000Z","size":315,"stargazers_count":7,"open_issues_count":0,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-08T00:13:54.281Z","etag":null,"topics":["cacheobjectscript-udl","intersystems","intersystems-cache","pivot-tables"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikitaeverywhere.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-02T18:38:49.000Z","updated_at":"2023-02-08T14:03:08.000Z","dependencies_parsed_at":"2023-01-11T21:45:04.786Z","dependency_job_id":null,"html_url":"https://github.com/nikitaeverywhere/LightPivotTable","commit_stats":null,"previous_names":["zitros/lightpivottable"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikitaeverywhere%2FLightPivotTable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikitaeverywhere%2FLightPivotTable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikitaeverywhere%2FLightPivotTable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikitaeverywhere%2FLightPivotTable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikitaeverywhere","download_url":"https://codeload.github.com/nikitaeverywhere/LightPivotTable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223779603,"owners_count":17201288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cacheobjectscript-udl","intersystems","intersystems-cache","pivot-tables"],"created_at":"2024-11-09T03:16:32.847Z","updated_at":"2024-11-09T03:16:34.493Z","avatar_url":"https://github.com/nikitaeverywhere.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Light pivot table for InterSystems Caché\n====================\n\nLightweight, fast and featured pivot table realization for\n[InterSystems Caché](http://www.intersystems.com).\n\n## Features\n\u003cul\u003e\n    \u003cli\u003eBasic functionality of standard pivot table;\u003c/li\u003e\n    \u003cli\u003eAdditional features like pagination and quick search;\u003c/li\u003e\n    \u003cli\u003eSimple good looking design;\u003c/li\u003e\n    \u003cli\u003eLightweight and speedy realization comparing to common DeepSee pivot table;\u003c/li\u003e\n    \u003cli\u003eMobile platforms support;\u003c/li\u003e\n    \u003cli\u003eEasiest integration to any WEB project;\u003c/li\u003e\n    \u003cli\u003eAnd even more...\u003c/li\u003e\n\u003c/ul\u003e\n\n## Installation\n\nThere are several variants how to install Light pivot table.\n+ Pre-requirement: install and configure [MDX2JSON](https://github.com/intersystems-ru/Cache-MDX2JSON) to your Caché instance;\n+ If you want to use LPT as a DeepSee portlet, then just download latest release from [github releases](https://github.com/intersystems-ru/LightPivotTable/releases), unpack it and Simply inport XML file to Caché;\n+ If you want to integrate LPT with your application, you need webModule/ directory contents that can be found in release you downloaded;\n+ If you want to build most up-to-date version from sources, see the \"build\" section below.\n\n## Integration\n\n#### Javascript\n\nBuild the project, and then include \u003ccode\u003ebuild/WEBModule/css/lightPivotTable.css\u003c/code\u003e and\n\u003ccode\u003ebuild/WEBModule/js/lightPivotTable.js\u003c/code\u003e files into your project. Usage is shown in\n\u003ccode\u003ebuild/WEBModule/index.html\u003c/code\u003e example.\n\nThen use global object constructed from \u003ci\u003eLightPivotTable\u003c/i\u003e:\n```js\nvar setup = { // Object that contain settings. Properties in brackets can be missed.\n        container: document.getElementById(\"pivot\") // HTMLElement which will contain table.\n        [, locale: \"en\" ] // language to use (default: browser default or \"en\")\n        [, logs: false ] // logging disabled by default\n        , dataSource: {\n            MDX2JSONSource: \"http://localhost:57772/SAMPLES\", // MDX2JSON server address\n            basicMDX: typeof req === \"object\" ? req.basicMDX : req\n            [ , pivot: \"name of data source.pivot\" ] // name of data source to apply pivot rules\n            [ , namespace: \"SAMPLES\" ] // current namespace : default namespace\n            [ , username: \"USER\" ] // user name : default user\n            [ , password: \"\" ] // user password : default password\n            [ , sendCookies: false ] // also send cookies with each request to server\n        }\n        [ , triggers: { // provide your functions here to handle certain events\n             drillDown: function ({Object { level: {number}, mdx: {string} }}) {}\n            , drillThrough: function ({Object { level: {number}, mdx: {string} }}) {}\n            , back: function ({Object { level: {number} }}) {}\n            // if cellDrillThrough callback returns boolean false, DrillThrough won't be performed.\n            , cellDrillThrough: function ({Object { event: {event}, filters: {string[]}, cellData: {object} }}) {}\n            , responseHandler: function ({Object {url: {string}, status: {number}}}) {}\n            // triggers when row selected in listing:\n            , rowSelect: function (row, rowData) { console.log(\"Row #\", row, rowData); }\n            // if rowClick callback returns boolean false, DrillDown won't be performed.\n            , rowClick: function (row, rowData) { console.log(row, rowData); }\n            , contentRendered: function () {}\n            , cellSelected: function ({ x: Number, y: Number, leftHeaderColumnsNumber: Number, topHeaderRowsNumber: Number }) {\n                return false; // return false to block default click action\n            }\n        } ]\n        [ , stretchColumns: true ] // Stretch columns to fill available container space\n        [ , pagination: 30 ] // Maximum rows number on one page (default: 200, turn off: 0)\n        [ , hideButtons: true ] // hides \"back\" and \"drillThrough\" buttons\n        [ , triggerEvent: \"touchstart\" ] // all \"click\" events will be replaced by this event\n        [ , caption: \"My table\" ] // if set, table basic caption will be replaced by this text\n        [ , showSummary: true ] // show summary by columns\n        [ , attachTotals: true ] // display totals attached to table top header\n        [ , conditionalFormattingOn: true ] // pass false to turn off conditional formatting\n        [ , loadingMessageHTML: \"LOADING DATA...\" ] // HTML displaying during data load\n        [ , enableHeadersScrolling: false ] // enable scrolling both for table and headers. Useful for mobile devices.\n        [ , defaultFilterSpecs: [\"[Date].[H1].[month].\u0026[]\"] ] // default filters array\n        [ , drillDownTarget: \"\u003cdashboard name\u003e\" ] // deepSee only - dashboard to open\n        [ , listingColumnMinWidth: 200 ] // minimal width of column in listing\n        [ , maxHeaderWidth: 100 ] // maximum width of header\n        [ , columnResizing: true ] // make columns resizable (default: true)\n        [ , columnResizeAnimation: false ] // animate column when resizing\n        [ , enableSearch: true ] // enables search panel in listing (default: true)\n        [ , showRowNumbers: true ] // show the row number in first column\n        [ , enableListingSelect: true ] // enable listing selection, true by default\n        [ , showListingRowsNumber: true ] // show rows number in listing and tables if paginated\n        [ , rowCount: 5 ] // number of rows to show. Use lp.setRowCount(N) to change rowCount. Manual lp.refresh() needed to apply.\n        [ , initialData: { ... } ] // initial data from /MDX query (if present, in MDX2JSON format). Pivot won't request /MDX first time if initial data set. Check twice that dataSource.basicMDX is consistent with the data in this option.\n        [ , linksTarget: \"_blank\" ] // the value of target attributes on all the links on light pivot\n    },\n    lp = new LightPivotTable(setup);\n    \nconsole.log(lp.CONTROLS); // object with functions that can be triggered to control pivot table:\n/* Available controls:\n * lp.CONTROLS.drillThrough() - Perform drillThrough for current location.\n * lp.CONTROLS.customDrillThrough([\"filterSpec1\", ...]) - Perform drillThrough with filters.\n * lp.CONTROLS.back() - Back to the parent level.\n */\n\nlp.setFilter(\"[DateOfSale].[Actual].[YearSold].\u0026[2009]\");\n\nlp.refresh(); // refresh pivot contents\nlp.updateSizes(); // recalculate pivot sizes\nlp.changeBasicMDX(\"...\"); // change mdx for LPT\nvar rows = lp.getRowsValues([1,2,3]); // returns the values in rows 1, 2, 3\nvar model = lp.getModel(); // returns data model representing currently rendered data set\nlp.getSelectedRows(); // returns array with selected rows indexes. First row have index 1.\nlp.attachTrigger(\"contentRendered\", function (lptInstance) {  }); // attaches trigger during runtime\nlp.setRowCount(5); // sets the number of rows to display\nconsole.log( lp.isListing() ); // returns true if current data display is listing\n\n// Additional calls:\nlp.pivotView.getCellElement(x, y, considerHeaders); // returns cell element by given coordinates\nlp.pivotView.getTableSize(considerHeaders); // returns { width: N, height: M }\n```\n\n#### Caché DeepSee\n\nTo integrate light pivot widget into DeepSee, just perform build and then import \u003ccode\u003e\nbuild/LightPivotTable.xml\u003c/code\u003e into namespace you want. Make sure that MDX2JSON source is\ninstalled and configured. Also you may need to change the widget property \"MDX2JSON source\" to make\nit work with another MDX2JSON source.\n\nYou can obtain LPT instance from widget by calling widgetInstance.registerLPTOnCreateCallback method.\nThis method takes one argument - anonymous function, which will be executed when LPT instance is created.\nThe anonymous function takes one argument - LPT instance.\n\n## Build\n\nYou need [NodeJS](http://nodejs.org/) platform to be installed in your system to perform any build\ntasks.\n\nTo build project and see working example, gulp and it's plugins must be installed. Simple run \n\u003ccode\u003enpm install\u003c/code\u003e command to perform all required installations.\n\nBy running \u003ccode\u003enpm run build\u003c/code\u003e command later, \u003ccode\u003ebuild\u003c/code\u003e directory will appear with \nall required files there.\n\n## Debug\n\nRun \u003ccode\u003enpm install\u003c/code\u003e in the project root to\ninstall all required modules, and then execute \u003ccode\u003enode test/testServer\u003c/code\u003e to run local\nserver. Then give the right URL and MDX as in the example in example/index.html file.\n\nAlso anytime you can build project and then check \u003ccode\u003ebuild/example/index.html\u003c/code\u003e page. \n\n## Preview\n\nRun \u003ccode\u003enpm run build\u003c/code\u003e command and then check \u003ccode\u003ebuild/WEBModule/index.html\u003c/code\u003e.\n![Light pivot table](https://cloud.githubusercontent.com/assets/4989256/5821832/b73c880c-a0d7-11e4-8458-832329b1c48a.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikitaeverywhere%2Flightpivottable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikitaeverywhere%2Flightpivottable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikitaeverywhere%2Flightpivottable/lists"}