jQWidgets Forums
jQuery UI Widgets › Forums › Grid › getSelectedCells in pivotGrid
Tagged: #pivotgrid, javascript pivotgrid, jquery pivotgrid, jqwidgets pivotgrid, jqxPivotGrid selectedcell
This topic contains 3 replies, has 2 voices, and was last updated by Hristo 6 years, 6 months ago.
-
Author
-
Hi,
i am facing some issue for getting the the selected cells from a pivotgrid.
In my development, the selected cells from the pivot gris is used as input for a graph. basically, I try to get all selected cells when I select a pivotItem (.on(‘pivotitemClick’…) and inject the value of selected cells in a graph.when i call “pivotCells.getSelectedCells()” I never get any selected cells.
here my code:
$('#divPivotGrid').on('pivotitemclick', function (event) { var pivotCells = $('#divPivotGrid').jqxPivotGrid('getPivotCells'); var pivotSelectedCells = pivotCells.getSelectedCells(); var pivotRow = pivotSelectedCells[0]; //here get the header of each selected column var selectedCellheaderValues = //???? var selectedCellValues = //????? var chartInstance = $('#chartContainer').jqxChart('getInstance'); if(chartInstance == null ) window.alert("empty y values"); chartInstance.seriesGroups[0].source = selectedCellheaderValues; chartInstance.source = selectedCellValues; $('#chartContainer').jqxChart('update'); });
thanks for you help
regards
DHSHello DHS,
Please, take a look at this example.
It demonstrates how to use thegetSelectedCells
method it is part of the “pivotgridCells”.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
many thanks about this example. very helpful.
It works only when I select cells. if I click on the pivot row I do not have values from the array returned by getSelectedCells(), however all cells are selected including the row header (the first cell of the row).
could tell me why the array is empty?regards
Hello,
Thank you for this feedback I will add work item for discussion.
Meanwhile, you could try to bind to “pivotitemclick” event and then you could recognize when it is clicked on ‘pivotitem’ (columns or rows).
When this happens you could get the records in this particular column (or row).Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.