jQWidgets Forums
Forum Replies Created
-
Author
-
but my error is not on the logic. I created a cellsrenderer but if I do sorting does render stays in the same rows. like for example i have a custom buttons and when I render.. say the button is in 3rd rows.. when I sorted the button is still there and it should be in last row or something because it should follow the data. i think the error occurs when we use the sorting.
this is my sample code for the coloring the cell
$(“#jqxgridPolicyHeader”).jqxGrid(
{
width: 1800,
height: 850,
rowsheight: 25,
source: adapterPolicyHeader,
pageable: true,
altrows: true,
showfilterrow: true,
filterable: true,
sortable: true,
pagesizeoptions: [’25’, ’50’, ‘100’],
pagesize: 20,
theme: ‘energyblue’,
rendergridrows: function () {
return adapterPolicyHeader.records;
},
//rowdetailstemplate: { rowdetails: “<div id=’grid’ style=’margin: 10px;’></div>”, rowdetailsheight: 200, rowdetailshidden: true },
columns: [
{ text: ‘Status ‘, dataField: ‘StatusCdId’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘number’, pinned: true },
{ text: ‘Header Id’, dataField: ‘PolicyHeaderId’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘number’, pinned: true },
{ text: ‘Policy No’, dataField: ‘PolicyNo’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘number’, pinned: true },
{ text: ‘Effective Date’, dataField: ‘PolicyEffectiveDt’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘input’, pinned: true },
{ text: ‘Expiration Date’, dataField: ‘PolicyExpirationDt’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘input’ },
{ text: ‘Earnings Days’, dataField: ‘PolicyEarningsDays’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘number’ },
{ text: ‘Insured Names’, dataField: ‘InsuredNm’, width: 200, cellsrenderer: headerRenderer, columntype: ‘textbox’, filtertype: ‘input’}]
});var headerRenderer = function (row, column, value, defaultHtml) {
var rows = $(“#jqxgridPolicyHeader”).jqxGrid(‘getrows’);
var defaultRow = rows[0];
var firstRow = rows[row];
getDefaultHtml = defaultHtml
var getstatusimg = ”;
var cellValue1 = ”;
if (value == ” || value == null) {
var getDefaultHtml = defaultHtml.replace(“</div>”, “ </div>”)
}
var element = $(getDefaultHtml);
if (firstRow === undefined && defaultRow === null) {
return ‘<div id=”statusRefresh” class=”default”> </div> ‘;
}
else {
if (firstRow === undefined && defaultRow !== null) {
cellValue1 = firstRow.StatusCdId;
} if (firstRow !== undefined && defaultRow !== null) {
cellValue1 = firstRow.StatusCdId;
}
// 1
if (cellValue1 == 43744) {
getstatusimg = ‘<div id=”ib’ + row + ‘” ><span style=”margin-left: 4px; margin-top: 9px; float: left;”>’ + value + ‘</span> </div> ‘;
}
// 2
else if (cellValue1 == 1111) {
element.css({ ‘background-color’: ‘red’,’color’: ‘white’});
getstatusimg = element[0].outerHTML;
}
// 3
else if (cellValue1 == 2222) {
getstatusimg = ‘<div id=”ib’ + row + ‘” ><span style=”margin-left: 4px; margin-top: 9px; float: left;”>’ + value + ‘</span> </div> ‘;
}
return getstatusimg;
}
};Hi,
I got an issue rendering the grid when using sorting.
I’m creating a cell coloring when rendering on the grid and the first load it’s working ok but if I sorted it the color is not following the right condition.My condition is if I got like 1111 in the row value in first column then I will show red and 2222 for orange something like that but when I click the sorting then the color is not going to the right cells. -
AuthorPosts