icefaces定制的dojo data grid

icefaces定制的dojo data grid

页面代码

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:dojo="http://www.icefaces.org/icefaces-ext/dojo/component"
xmlns:yui="http://www.icefaces.org/icefaces-ext/yui/component">
<body>
<ui:composition template="/inc/template.xhtml">
<ui:param name="path"
value="#{facesContext.externalContext.requestContextPath}" />
<ui:define name="content">

<ice:form id="frmCommonSearch">
<div style="display: none"><ice:inputHidden id="manufacturerId"
value="#{commonSearchBean.manufacturerId}" /> <ice:commandLink
id="antiSearchBom"
actionListener="#{commonSearchBean.antiSearchBom}" /> <ice:commandButton
action="#{commonSearchBean.editSetup}" id="editSetup" /></div>

<ice:commandButton value="#{msg['back']}" action="commonSearchInput" />
<ice:commandButton value="#{msg['download']}" partialSubmit="true"
actionListener="#{commonSearchBean.download}" />

<ice:commandButton value="#{msg['saveView']}" action="#{commonSearchBean.saveView}"/>

<dojo:dataGrid pagingConfig="#{commonSearchBean.pagingConfig}"
id="searchModel" selectable="true" identifier="manufacturerId"
canSort="foo" width="100em" height="43.5em"
value="#{commonSearchBean.dataList}">

<dojo:gridView noscroll="true">
<dojo:columnGroup>

<dojo:column field="materialCode" width="15" sortable="true"
value="#{msg['materialCode']}"
rendered="#{queryFieldSelectionBean['materialCode']}" />
<dojo:column field="manufacturerCode" sortable="true"
value="#{msg['manufacturerCode']}" width="12"
rendered="#{queryFieldSelectionBean['manufacturerCode']}" />
<dojo:column field="catName" formatter="true"
value="#{msg['catName']}" />
<dojo:column width="10" formatter="true"
rendered="#{roles['engineer'] or roles['researcher']}" value="#{msg['dataMaintain']}"
field="dataMaintain" />

<dojo:column width="20" formatter="true"
value="#{msg['antiSearch']}" field="antiSearch" />
</dojo:columnGroup>
</dojo:gridView>
<dojo:gridView noscroll="false">
<dojo:columnGroup>
<dojo:column field="manufacturerName" width="30"
value="#{msg['manufacturerName']}"
rendered="#{queryFieldSelectionBean['manufacturerName']}" />
<dojo:column field="qualityStatusLevel"
value="#{msg['qualityStatusLevel']}"
rendered="#{queryFieldSelectionBean['qualityStatusLevel']}" />
<dojo:column field="qualityStatusLevelDesc"
value="#{msg['qualityStatusLevelDesc']}"
rendered="#{queryFieldSelectionBean['qualityStatusLevelDesc']}" />
<!-- material -->
<dojo:column field="description" value="#{msg['description']}"
width="40" rendered="#{queryFieldSelectionBean['description']}" />
<dojo:column field="rohsAuthentication" formatter="true"
rendered="#{queryFieldSelectionBean['rohsAuthentication']}"
value="#{msg['rohsAuthentication']}" />
<dojo:column field="erpStatus" value="#{msg['erpStatus']}"
formatter="true"
rendered="#{queryFieldSelectionBean['erpStatus']}" />

<!-- manufacturer -->
<dojo:column field="annualStock" value="#{msg['annualStock']}"
rendered="#{queryFieldSelectionBean['annualStock']}" />
<dojo:column field="annualReject" value="#{msg['annualReject']}"
rendered="#{queryFieldSelectionBean['annualReject']}" />
<!-- spec -->
<dojo:column field="model" value="#{msg['model']}"
rendered="#{queryFieldSelectionBean['model']}" />
<dojo:column field="functionDesc" value="#{msg['functionDesc']}"
rendered="#{queryFieldSelectionBean['functionDesc']}" />
<dojo:column field="acknowledgmentAuthor"
value="#{msg['acknowledgmentAuthor']}"
rendered="#{queryFieldSelectionBean['acknowledgmentAuthor']}" />
<dojo:column field="acknowledgmentVersion"
value="#{msg['acknowledgmentVersion']}"
rendered="#{queryFieldSelectionBean['acknowledgmentVersion']}" />
<dojo:column field="edeNum" formatter="true" value="#{msg['edeNum']}"
rendered="#{queryFieldSelectionBean['edeNum']}" />
<dojo:column field="firstUsedOccasion"
value="#{msg['firstUsedOccasion']}"
rendered="#{queryFieldSelectionBean['firstUsedOccasion']}" />
<dojo:column field="customVersion" value="#{msg['customVersion']}"
rendered="#{queryFieldSelectionBean['customVersion']}" />
<dojo:column field="softwareVersion"
value="#{msg['softwareVersion']}"
rendered="#{queryFieldSelectionBean['softwareVersion']}" />
<dojo:column field="reliability" value="#{msg['reliability']}"
rendered="#{queryFieldSelectionBean['reliability']}" />
<dojo:column field="maintainReject"
value="#{msg['maintainReject']}"
rendered="#{queryFieldSelectionBean['maintainReject']}" />
<dojo:column field="securityAuthentication"
value="#{msg['securityAuthentication']}"
rendered="#{queryFieldSelectionBean['securityAuthentication']}" />
<dojo:column field="otherAuthentication"
value="#{msg['otherAuthentication']}"
rendered="#{queryFieldSelectionBean['otherAuthentication']}" />
<dojo:column field="jointingDemand"
value="#{msg['jointingDemand']}"
rendered="#{queryFieldSelectionBean['jointingDemand']}" />
<dojo:column field="coat" value="#{msg['coat']}"
rendered="#{queryFieldSelectionBean['coat']}" />
<dojo:column field="cleanDemand" value="#{msg['cleanDemand']}"
rendered="#{queryFieldSelectionBean['cleanDemand']}" />
<dojo:column field="msdLevel" value="#{msg['msdLevel']}"
rendered="#{queryFieldSelectionBean['msdLevel']}" />
<dojo:column field="esdLevel" value="#{msg['esdLevel']}"
rendered="#{queryFieldSelectionBean['lifeEndDay']}" />
<dojo:column field="lifeEndDay" value="#{msg['lifeEndDay']}"
rendered="#{queryFieldSelectionBean['lifeEndDay']}" />
<dojo:column field="stockCycle" value="#{msg['stockCycle']}"
rendered="#{queryFieldSelectionBean['stockCycle']}" />
<dojo:column field="perform" value="#{msg['perform']}"
rendered="#{queryFieldSelectionBean['perform']}" />
<dojo:column field="service" value="#{msg['service']}"
rendered="#{queryFieldSelectionBean['service']}" />
<dojo:column field="remark" value="#{msg['remark']}"
rendered="#{queryFieldSelectionBean['remark']}" />
<!-- <dojo:column field="created" value="#{msg['created']}" /> -->
</dojo:columnGroup>
</dojo:gridView>
</dojo:dataGrid>

</ice:form>

</ui:define>
</ui:composition>
</body>
</html>
##### js代码,reRender formatter="true"的列
// search model data grid
antiSearchBom = function(materialCode, flag) {
    var param = '?materialCode=' + materialCode + '&flag=' + flag;
    // $('frmCommonSearch:antiSearchBom').click();
    Common.open('/ppl/viewBom' + param);
}

paramDetail = function(manufacturerId, catId) {
    var param = '?manufacturerId=' + manufacturerId;
    // alert(param);
    // $('frmCommonSearch:antiSearchBom').click();
    Common.open('/ppl/viewParam' + param);
}

searchModel_materialCode = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var manufacturerId = dataItem.manufacturerId;
    return "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"editSetup('"
    + manufacturerId + "');return false;\" href=\"javascript:;\">"
    + value + "</a>";

}

searchModel_componentAntiSearch = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var materialCode = dataItem.materialCode;
    return "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"javascript:antiSearchBom('"
    + materialCode
    + "','component');return false;\" href=\"javascript:;\">"
    + value
    + "</a>";

}
searchModel_dataMaintain = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var manufacturerId = dataItem.manufacturerId;
    return "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"editSetup('"
    + manufacturerId + "');return false;\" href=\"javascript:;\">"
    + value + "</a>";

}
searchModel_antiSearch = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var id = dataItem.id;
    var materialCode = dataItem.materialCode;

    var component = "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"javascript:antiSearchBom('"
    + materialCode
    + "','component');return false;\" href=\"javascript:;\">"

    + "组件反查</a>";

    var deviceType = "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"javascript:antiSearchBom('"
    + materialCode
    + "','deviceType');return false;\" href=\"javascript:;\">"

    + "机型反查</a>";

    return component + '&nbsp;&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;&nbsp;'
    + deviceType;
}
searchModel_deviceTypeAntiSearch = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var materialCode = dataItem.materialCode;
    return "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"javascript:antiSearchBom('"
    + materialCode
    + "','deviceType');return false;\" href=\"javascript:;\">"
    + value
    + "</a>";
}

searchModel_rohsAuthentication = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    // var rohs = dataItem.rohsAuthentication;
    if (value == '00' || value == 'R2') {
        // 取消冻结
        value = '是';
    } else if (value == '') {
        value = '';
    } else {
        // 冻结
        value = '否';
    }
    return value;

}

searchModel_erpStatus = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    // var rohs = dataItem.rohsAuthentication;

    if (value == '00' || value == 'R2') {
        // 取消冻结
        value = '可采购';
    } else if (value == '') {
        value = '';
    } else {
        // 冻结
        value = '不可采购';
    }
    return value;

}

searchModel_catName = function(value, rowIndex) {

    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var materialCode = dataItem.materialCode;

    var manufacturerId = dataItem.manufacturerId;
    // var catId = dataItem.catId;
    // if (catId == '' || catId == 'null') {
    // catId == 0;
    // }

    var catName = dataItem.catName;
    // alert(manufacturerId + "--- " + catName);
    if (value == undefined) {
        value = '';
    }
    // var target = "/ppl/viewParam?manufacturerId=" + manufacturerId
    // + "&catName=" + catName;
    return "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"paramDetail('"
    + manufacturerId + "');return false;\" href=\"javascript:;\">"
    + value + "</a>";
}

searchModel_edeNum = function(value, rowIndex) {
    var dataItem = dijit.byId('searchModel').getItem(rowIndex);
    var edeNum = dataItem.edeNum;
    if(edeNum=='null'||edeNum==undefined){
        edeNum='';
    }
    return "<a class=\"iceCmdLnk iceCmdLnkExt\" onclick=\"edeLink('"
    + edeNum+ "');return false;\" href=\"javascript:;\">"
    + edeNum + "</a>";

}

######
back bean 里的render方法,在render前这个方法会被执行
    public void searchModelRender() {
        dataList = serviceLocator.getSearchedModelService().getSearchModel(
                commonSearchDto.getWhereSql(), pagingConfig);

    }

你可能感兴趣的:(html,xml,bean,XHTML,dojo)