grid

grid

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  78 Posts :: 0 Stories :: 62 Comments :: 0 Trackbacks
TreeGrid:绘制单元格
            
            
参考示例: TreeGrid:绘制单元格    
               
          

监听处理"drawcell"事件         

使用"drawcell"事件,可以自定义单元格内容、样式、行样式等。

function onDrawCell(e){
    var node = e.node,
        column = e.column,
        field = e.field,
        value = e.value;

    //格式化日期
    if (field == "Finish") {
        if (mini.isDate(value)) e.cellHtml = mini.formatDate(value, "yyyy年MM月dd日");
    }
    //工期
    if (field == "Duration") {
        e.cellHtml = value + "天";
    }
    //进度
    if (field == "PercentComplete") {
        e.cellHtml = '<div class="progressbar">'
                        + '<div class="progressbar-percent" style="width:' + value + '%;"></div>'
                        + '<div class="progressbar-label">' + value + '%</div>'
                    +'</div>';
    }
};
posted on 2012-12-14 15:58 nikofan 阅读(2729) 评论(2)  编辑  收藏

Feedback

# re: jQuery MiniUI 开发教程 TreeGrid 自定义单元格(三) 2012-12-15 01:54 11
/**
* 得到显示BOM对比的Render
* @param list
* @return
*/
public static Object[] getComparisonReportRenderer(List<WTPart> list){
Object obj[] = new Object[2];
ComparisonReportRenderer comparisonReportRenderer = new DefaultComparisonReportRenderer();
try {
StringBuffer linkstoCompare = new StringBuffer();
//需进行WTPartUsageLink 的比较
linkstoCompare.append("wt.part.WTPartUsageLink");

Set <String>linkstoCompareSet = null;
if(linkstoCompare != null && linkstoCompare.length() > 0){
String [] linkstoCompareArr = linkstoCompare.toString().split(",");

linkstoCompareSet = new HashSet <String>();
for(String link : linkstoCompareArr) {
linkstoCompareSet.add(link);
}
}
WTList objList = new WTArrayList();
objList.addAll(list);
SimpleComparisonSpec cmpSpec = ComparisonSpec.newSimpleInstance(objList);
cmpSpec.setLocale(Locale.CHINA);
cmpSpec.setSelectedLinks(linkstoCompareSet);
ComparisonResult cmpResult = ObjComparisonHelper.service.compareDomainObjs(cmpSpec);
List linkDiffList = cmpResult.getLinkDiffsMap().get("wt.part.WTPartUsageLink");
List<Object[]> linkList = new ArrayList<Object[]>();
if(linkDiffList != null)
for(Iterator it = linkDiffList.iterator(); it.hasNext();) {
LinkDiffs ld = (LinkDiffs)it.next();
List linkReference = ld.getLinkRefs();
if(linkReference != null) {
Object[] objTemp = new Object[2];
Object temp = linkReference.get(0);
if(temp != null) {
WTReference wf = (WTReference)temp;
objTemp[0] = wf.getObject();
}
temp = linkReference.get(1);
if(temp != null) {
WTReference wf = (WTReference)temp;
objTemp[1] = wf.getObject();
}
linkList.add(objTemp);
}
}
comparisonReportRenderer.init(cmpResult, objList, BASE_URL, Locale.CHINA);
obj[0] = comparisonReportRenderer;
obj[1] = linkList;
} catch (ConfigResourceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WTPropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return obj;
}  回复  更多评论
  

# re: jQuery MiniUI 开发教程 TreeGrid 自定义单元格(三) 2012-12-17 16:36 11
//更改创建者
public static void setCreator() throws WTRuntimeException, WTException,
SecurityException, NoSuchMethodException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
try {
wt.fc.ReferenceFactory rf = new wt.fc.ReferenceFactory();
WTPart part = (WTPart) rf.getReference("VR:wt.part.WTPart:8569897")
.getObject();
WTUser newCreator = (WTUser) wt.org.OrganizationServicesHelper.manager
.getUser("xxx");

Class[] classWTPrinicipalReference = new Class[] { WTPrincipalReference.class };
Method setCreator = null;
try {
setCreator = _IterationInfo.class.getDeclaredMethod(
"setCreator", classWTPrinicipalReference);
} catch (java.lang.Exception e) {
e.printStackTrace();
}
setCreator.setAccessible(true);
IterationInfo iterationInfo = part.getIterationInfo();
setCreator.invoke(iterationInfo,new Object[] { (WTPrincipalReference) rf.getReference(newCreator) });
wt.fc.PersistenceServerHelper.manager.update(part);
} catch (Exception e) {
e.printStackTrace();
}
}  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: