struts jquery标签的新功能。想知道,是否有可能动态地改变网格的内容类型。我使用格式化程序做了部分成功。
<s:url id="insertAttrTypeUrl"
action="populateCreateAttributeSetupGrid">
</s:url>
<sjg:grid id="insertAttrTyGrid" href="%{insertAttrTypeUrl}"
dataType="json" name="insertAttrTyGrid"
formIds="attributeSetupForm" caption="Create New Attribute Type"
reloadTopics="reloadInsertAttrTyGrid"
onSelectRowTopics="insertAttrTyRowSelect" gridModel="insertGridViewList"
gridview="true" viewrecords="true" requestType="post" height="150">
<sjg:gridColumn name="columnName" index="columnName"
id="columnName" title="COLUMN NAME" align="center"
sortable="false" width="140" />
<sjg:gridColumn name="columnValue" index="columnValue"
id="columnValue" title="COLUMN VALUE" align="center"
sortable="false" formatter="formatColumnValue" width="160" />
<sjg:gridColumn name="displayColumnType" index="displayColumnType"
id="displayColumnType" title="DATA TYPE" align="center"
sortable="false" width="135" />
</sjg:grid>
function formatColumnValue(cellvalue, options, rowObject){
var colName = rowObject.columnName;
if (cellvalue == null) {
cellvalue = "";
}
if(colName==="CREATED_BY" || colName==="TYPE_NAME" || colName==="DISPLAY_NAME"){
var rdioHtml = "<input type='text' style='text-align:center; width:150px;' name='columnValue' id='columnValue'"
+ options.rowId + "' value='"+cellvalue+"'/>";
return rdioHtml;
}
if(colName==="DESCRIPTION"){
var txtA = "<input type='textarea' cols='20' rows='5' style='text-align:center; width:150px;' name='columnValue' id='columnValue'"
+ options.rowId + "' value='"+cellvalue+"'/>";
return txtA;
}
文本区域不会出现,正在打印普通文本框。如果我们需要使用任何其他标签,请建议。