Hi,
I want to create something like the worksheet Excel in attachment it's a Cross Table.
Can you help me to determine, which tool I need to use use a Grid or PivotGrid ?
I had try with PivotGrid but it's a flat data so so ...
I know we can custom Grid but I need a representation like a PivotGrid.
Actually I am working with a flat data source.
We would have header columns custom with (*) if the cell's color is red for example
Just see my attachment you will understand my message.
Thank you very much.
Hello Madani,
From what I see this is a scenario for igPivotGrid. The igPivotGrid has a functionality to bind to flat data source. For example please see the "Binding to Flat Data Source" sample.
Coloring of the cells can be achieved by binding to igGrid.rowsRendering event and manipulating its column collection where there are options(format, formatter, columnCssClass) for formatting the cell values.
I'm attaching a sample demonstrating your scenario.
Hope this helps,Martin PavlovInfragistics, Inc.
Thanks for answer quickly to my question.
This respond correctly to my request.
I will try it have a goor day :)
I'm glad I was able to help you.
Let me know if you have further questions regarding this subject.
Best regards,Martin PavlovInfragistics, Inc.
Hi Martin,
Thanks a lot I just want to ask you something.
My new problem is about the onClick Mouse when a user want to click on the cell and add a comment for example open a pop up and add a coment on it.
Then I need to refresh the grid and add the color on this value.
For now, I want just to catch the value.
I have try with this but I can't can you help me, if you have sometimes or just give the good syntaxe thanks.
Othe question :
There should be a way to do Cell selection so we would have the add the same value on the cells selected.
I had read this tip but I think we can't http://ideas.infragistics.com/forums/211535-ignite-ui/suggestions/6424389-olap-pivot-grid-cell-selectioni
I will attach my programm
Thanks in advance :)
On your first question. You can handle the igGrid.events.cellClick event and show a dialog to collect the feedback from the user. The "cellClick" event also provides you with the ui.colIndex and ui.rowIndex params which you can use for the igGrid.methods.cellAt API. Here is an example code:
$("#pivotGrid").on("iggridcellclick", function (evt, ui) { var val = prompt("Enter your comment, please"); if (val) { ui.owner.cellAt(ui.colIndex, ui.rowIndex).style.backgroundColor = "blue"; } });
$("#pivotGrid").on("iggridcellclick", function (evt, ui) {
var val = prompt("Enter your comment, please");
if (val) {
ui.owner.cellAt(ui.colIndex, ui.rowIndex).style.backgroundColor = "blue";
}
});
On your second question. You can enabled the igGrid Selection feature from the igPivotGrid.options.gridOptions.features object like this:
gridOptions : { features: [ { name: "Selection", mode: "cell", multipleSelection: true } ] }
gridOptions :
{
features: [
name: "Selection",
mode: "cell",
multipleSelection: true
]
Then if you want to get the selected cells at runtime you should use the igGridSelection.methods.selectedCells method like this:
$($("#pivotGrid").igPivotGrid("grid").element).igGridSelection("selectedCells");
I modified your sample with the above code.