Hi All,
I am a newbie to to DHTML.
I have a Question about DHTML Grid.
my code is
mygrid = new dhtmlXGridObject("mygrid_container");
mygrid.setImagePath("<c:url value='/images/'/>");
var headerName = "";
var headerWidth = "";
var colAlign = "";
var colType = "";
var row = "";
var reSize = "";
<c:if test="${showResult eq 'Y'}">
<c:choose>
<c:when test="${Errors eq 'N'}">
<c:forEach items="${ColumnNames}" var="colName">
<c:if test="${colName ne '' }">
if(headerName == "")
{
headerName = '<c:out value="${colName}"/>';
headerWidth = '*';
colAlign = "left";
colType = "ro";
reSize = "true";
}
else
{
headerName = headerName + ',<c:out value="${colName}"/>';
headerWidth = headerWidth + ',*';
colAlign = colAlign + ",left";
colType = colType + ",ro";
reSize = reSize + ",true";
}
</c:if>
<c:if test="${colName eq ''}">
if(headerName == "")
{
headerName = 'column';
headerWidth = '*';
colAlign = "left";
colType = "ro";
reSize = "true";
}
else
{
headerName = headerName + ',column';
headerWidth = headerWidth + ',*';
colAlign = colAlign + ",left";
colType = colType + ",ro";
reSize = reSize + ",true";
}
</c:if>
</c:forEach>
mygrid.setHeader(headerName);
mygrid.setInitWidths(headerWidth);
mygrid.setColAlign(colAlign);
mygrid.setColTypes(colType);
mygrid.setSkin("light");
mygrid.enableResizing(reSize);
mygrid.enableAutoHeight(true);
mygrid.init();
var newId = 0;
var rowArray;
var rowCntr;
<c:forEach items="${queryResult}" var="rows">
row = "";
rowArray = new Array();
rowCntr = 0;
<c:forEach items="${ColumnNames}" var="colName">
rowArray[rowCntr++] = '<c:out value="${rows[colName]}" />';
</c:forEach>
mygrid.addRow(newId,rowArray,null);
newId++;
</c:forEach>
</c:when>
</c:choose>
</c:if>
div is
<div id="mygrid_container" style="width:100%"></div>
problem I am facing is that, i don’t have count of exact number of columns to display in results. Because of that I am setting Init Widths of grid as *. but if columns are more then i am not able to display data properly. so when i am trying to change width of column it is not getting re-sized. and column get shifted to original position.
can you please tell me about this problem ?