ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: eloan on October 24, 2016, 01:15:34 pm
-
Hi.
I used function to mergeCells and freezeCols.
If the certain column was made hidden, the reach of merging became unjust.
please, help me.
=== step ===
1. test source is used for under.
2. access by web browser. click button on "Test1 Hidden" and "Test2 Hidden".
3. Test3 column Merge is 1 colspan. but it increases in colspan 2. And right data slips.
=== test source ===
<script>
$(function () {
var obj = { width: 400, height: 200 };
obj.colModel = [ { title:"Test" , dataIndx:"a" }
,{ title:"Test2", dataIndx:"b" }
,{ title:"Test3", dataIndx:"c" }
,{ title:"Sum", dataIndx:"sum" }
,{ title:"data1", dataIndx:"data1" }
,{ title:"data2", dataIndx:"data2" }];
obj.freezeCols = 4;
obj.dataModel = { data: [{ "a":"test1", "b":"2", "c":"3", "sum":"6", "data1":"1", "data2":"5" }
, { "a":"test1", "b":"2", "c":"3", "sum":"6", "data1":"2", "data2":"4" }]};
var $grid = $("#grid").pqGrid(obj);
var mergeAry = [];
mergeAry.push({r1: 0, c1: 0, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 1, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 2, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 3, rc:2, cc:1});
$grid.pqGrid({mergeCells: mergeAry});
$grid.pqGrid("refreshView");
});
function chgColumn() {
var colModel = $("#grid").pqGrid("getColModel");
var mergeAry = [];
mergeAry.push({r1: 0, c1: 0, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 1, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 2, rc:2, cc:1});
$("#grid").pqGrid({mergeCells: mergeAry});
$("#grid").pqGrid("refreshView");
}
function chgHidden(i) {
var colModel = $("#grid").pqGrid("getColModel");
colModel.hidden = !colModel.hidden;
$("#grid").pqGrid("option", "colModel", colModel);
$("#grid").pqGrid("refreshView");
}
</script>
<body>
<input type="button" onclick="chgHidden(0);" value="Test1 Hidden">
<input type="button" onclick="chgHidden(1);" value="Test2 Hidden">
<input type="button" onclick="chgHidden(2);" value="Test3 Hidden">
<div id="grid" style="margin:auto;"></div>
</body>
-
Thanks for reporting the issue. I'm looking into it.
-
Please use the attached patch for this issue.
The patch file can be included after pqgrid.min.js file.
-
I'll be thankful for quick correspondence.
It was checked.
But it was insufficient.
The one indicated first is a simple source, and actual condition uses by 6 columns in front of sum.
A problem wasn't settled in this case.
When "Test1"~"Test3" is changed to hidden, it occurs.
Please look it.
=== Source near practical use ===
<script>
$(function () {
var obj = { width: 400, height: 300 };
obj.colModel = [ { title:"id", dataIndx:"id", hidden: true }
,{ title:"Test" , dataIndx:"a" }
,{ title:"Test2", dataIndx:"b" }
,{ title:"Test3", dataIndx:"c" }
,{ title:"Test4", dataIndx:"d" }
,{ title:"type", dataIndx:"type" }
,{ title:"Sum", dataIndx:"sum" }
,{ title:"data1", dataIndx:"data1" }
,{ title:"data2", dataIndx:"data2" }];
obj.freezeCols = 7;
obj.dataModel = { data: [{ "id":"1", "a":"test1", "b":"2", "c":"3", "d":"4", "type":"A", "sum":"6", "data1":"1", "data2":"5" }
, { "id":"2", "a":"test1", "b":"2", "c":"3", "d":"4", "type":"B", "sum":"6", "data1":"2", "data2":"4" }]};
var $grid = $("#grid").pqGrid(obj);
var mergeAry = [];
mergeAry.push({r1: 0, c1: 1, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 2, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 3, rc:2, cc:1});
mergeAry.push({r1: 0, c1: 4, rc:2, cc:1});
$grid.pqGrid({mergeCells: mergeAry});
$grid.pqGrid("refreshView");
});
function chgHidden(i) {
var colModel = $("#grid").pqGrid("getColModel");
colModel.hidden = !colModel.hidden;
$("#grid").pqGrid("option", "colModel", colModel);
$("#grid").pqGrid("refreshView");
}
</script>
<body>
<input type="button" onclick="chgHidden(1);" value="Test1 Hidden">
<input type="button" onclick="chgHidden(2);" value="Test2 Hidden">
<input type="button" onclick="chgHidden(3);" value="Test3 Hidden">
<input type="button" onclick="chgHidden(4);" value="Test4 Hidden">
<div id="grid" style="margin:auto;"></div>
</body>
-
Please find attached updated patch for this issue and let me know if you face any other issue.
-
Thank you very much.
A problem was settled.
I have one question.
Is this patch included by the next version?
-
You are welcome!
Yes this patch would be applied to the next version.
-
OK!
very thanks!!
Best Regards.