日期:2014-05-16 浏览次数:20416 次
documentum中用js获取datagrid中的数据,js操作datagrid
?
以下代码是js得到datagrid,且控制第一行被选中,并且得到选中行的第一列属性
?
//得到datagrid对象,WorkflowInfor为当前component对应的类名,mygrid为datagrid的name属性值
?
?var dg = wdk.dom.get('WorkflowInfor_mygrid_0').datagrid;
?
//获取行数
???? var count = dg.getRowCount();
???? if(count>0){
?
//选中第1行
??????dg.highlight(0,true);
???
//获得当前选中行的第一列属性值,返回值为数组
???var workflowId = dg.data.getItemActionArgs(0, 'select');???
???if(id!=workflowId[0]){
????url = "<%=Form.makeUrl(request,"/component/workflow_view_component?objectId=")%>" + "<%=objectId%>&workflowId=" + workflowId[0];
?
//其它操作
????changeFrameLocationInFrameset(parent, "workflow_view", url);
???}
???id = workflowId[0];
??}
?
?
?
有时候我们需要当单击datagrid的某行的时候,触发js方法做一些操作
?
?
<dmf:datagridRow name='attachcolumns' height='24'
????????cssclass='defaultDatagridRowAltStyle'
????????altclass="defaultDatagridRowStyle">
????????<dmf:datagridRowTd scope='row' valign="middle"
?????????cssclass='doclistfilenamedatagrid' width="250">
?????????<dmf:stringlengthformatter maxlen='16' wrapped='true'
??????????postfix='...'>
??????????<dmf:datagridRowEvent eventname="select"
???????????eventhandler="onViewAttachment" runatclient="true">
???????????<dmf:image datafield="icon" />
???????????<dmf:link onclick='onViewAttachment' name='objectLink'
????????????runatclient='true' datafield='workflow_name'>
????????????<dmf:argument name='objectId' datafield='workflow_id' />
???????????</dmf:link>
??????????</dmf:datagridRowEvent>
?????????</dmf:stringlengthformatter>
????????</dmf:datagridRowTd>
???????</dmf:datagridRow>
?
?
function onViewAttachment(event){
???? var url="";
??if (event.count == 1) {
???//alert(event.startIndex+"??? "+event.type);
???var workflowId = event.datagrid.data.getItemActionArgs(event.startIndex, event.type);???
???if(id!=workflowId[0]){
????url = "<%=Form.makeUrl(request,"/component/workflow_view_component?objectId=")%>" + "<%=objectId%>&workflowId=" + workflowId[0];
????changeFrameLocationInFrameset(parent, "workflow_view", url);
???}
???id = workflowId[0];
??}
?}