获取dojoxGridCell值

ar7v8xwq  于 2022-12-16  发布在  Dojo
关注(0)|答案(1)|浏览(130)

我一直在努力获取dojoxGridCell的值。我已经通读了dojo here的一些有用文档,但到目前为止无法获取单元格的值。
我正在使用AutoHotkey Unicode 64位v 1.1.25.01,以下是我目前所拥有的:

#Persistent
#SingleInstance, force
SetTitleMatchMode, 2

ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := 1
ie.Navigate("https://tmpa-fnsb.hs.mdmgr.net:8445")
While ( ie.Busy || ie.ReadyState != 4 )                                                                         ; Waits for the webpage to finish loading
    Sleep 10

WinMove, Cisco Finesse - Internet Explorer,,-842,313,843,324

ie.document.all.username.value := "USER"
ie.document.all.password.value := "PASS"
ie.document.all.extension.value := "EXT"
ie.document.all["signin-button"].click()
While ( ie.Busy || ie.ReadyState != 4 )                                                                         ; Waits for the webpage to finish loading
    Sleep 10

sleep 7000

Value:= grid.store.getValue(queueGrid.getItem(2), 3);
msgbox %Value%
Return

因为它不能公开访问,所以下面是网页的DOM:

<div id="queueBody">
        <div id="queueGrid">
        <div tabindex="0" align="left" class="dojoxGrid" id="dojox_grid_DataGrid_0" role="grid" aria-multiselectable="true" aria-readonly="true" style="height: auto;" hidefocus="hidefocus" widgetId="dojox_grid_DataGrid_0" dojoattachevent="onmouseout:_mouseOut">
    <div class="dojoxGridMasterHeader" role="presentation" style="height: 39px; display: block;" dojoattachpoint="viewsHeaderNode"><div class="dojoxGridHeader" role="presentation" style="left: 1px; top: 0px; width: 1477px;" dojoattachpoint="headerNode">
        <div role="presentation" style="width: 9000em;" dojoattachpoint="headerNodeContainer">
            <div role="row" dojoattachpoint="headerContentNode"><table class="dojoxGridRowTable" role="presentation" style="width: 1460px;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr0" role="columnheader" aria-readonly="true" style="margin: 0px; padding: 0px 0px 0px 10px; width: 20%; border-left-color: currentColor; border-left-width: 0px; border-left-style: none;" aria-sort="ascending" rowspan="2" idx="0"><div class="dojoxGridSortNode dojoxGridSortUp"><div class="dojoxGridArrowButtonChar">▲</div><div class="dojoxGridArrowButtonNode" role="presentation"></div><div class="dojoxGridColCaption">Queue Name</div></div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr1" role="columnheader" aria-readonly="true" style="width: 8%;" rowspan="2" idx="1"><div class="dojoxGridSortNode"># Calls</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr2" role="columnheader" aria-readonly="true" style="width: 8%;" rowspan="2" idx="2"><div class="dojoxGridSortNode">Max Time</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr3" role="columnheader" aria-readonly="true" style="width: 8%;" rowspan="2" idx="3"><div class="dojoxGridSortNode">Ready</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr4" role="columnheader" aria-readonly="true" style="width: 8%;" rowspan="2" idx="4"><div class="dojoxGridSortNode">Not Ready</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr5" role="columnheader" aria-readonly="true" style="text-align: center;" colspan="3" idx="5"><div class="dojoxGridSortNode">Active</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr6" role="columnheader" aria-readonly="true" style="text-align: center;" colspan="2" idx="6"><div class="dojoxGridSortNode">Wrap Up</div></th></tr><tr><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr7" role="columnheader" aria-readonly="true" style="width: 8%;" idx="7"><div class="dojoxGridSortNode">In</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr8" role="columnheader" aria-readonly="true" style="width: 8%;" idx="8"><div class="dojoxGridSortNode">Out</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr9" role="columnheader" aria-readonly="true" style="width: 8%;" idx="9"><div class="dojoxGridSortNode">Other</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr10" role="columnheader" aria-readonly="true" style="width: 8%;" idx="10"><div class="dojoxGridSortNode">Ready (Pending)</div></th><th tabindex="-1" class="dojoxGridCell " id="dojox_grid_DataGrid_0Hdr11" role="columnheader" aria-readonly="true" style="width: 8%;" idx="11"><div class="dojoxGridSortNode">Not Ready (Pending)</div></th></tr></tbody></table></div>
        </div>
    </div></div>
    <div class="dojoxGridMasterView" role="presentation" style="height: 36px;" dojoattachpoint="viewsNode"><div class="dojoxGridView" id="dojox_grid__View_1" role="presentation" style="left: 1px; top: 0px; width: 1477px;" widgetId="dojox_grid__View_1">

    <input class="dojoxGridHiddenFocus" role="presentation" type="checkbox" dojoattachpoint="hiddenFocusNode">
    <input class="dojoxGridHiddenFocus" role="presentation" type="checkbox">
    <div class="dojoxGridScrollbox" role="presentation" dojoattachpoint="scrollboxNode">
        <div class="dojoxGridContent" role="presentation" style="width: 1460px; height: 36px;" hidefocus="hidefocus" dojoattachpoint="contentNode"><div role="presentation" style="left: 0px; top: 0px; position: absolute;"><div class="dojoxGridRow" role="row" aria-selected="false"><table class="dojoxGridRowTable" role="presentation" style="width: 1460px;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="margin: 0px; padding: 0px 0px 0px 10px; width: 20%; text-align: left; border-left-color: currentColor; border-left-width: 0px; border-left-style: none;" rowspan="2" idx="0">TS_CL_SG_Primary</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="1">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="2">00:00:00</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="3">9</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="4">13</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" colspan="3" idx="5"></td><td tabindex="-1" class="dojoxGridCell " role="gridcell" colspan="2" idx="6"></td></tr><tr><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="7">1</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="8">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="9">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="10">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="11">0</td></tr></tbody></table></div><div class="dojoxGridRow dojoxGridRowOdd" role="row" aria-selected="false"><table class="dojoxGridRowTable" role="presentation" style="width: 1460px;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="margin: 0px; padding: 0px 0px 0px 10px; width: 20%; text-align: left; border-left-color: currentColor; border-left-width: 0px; border-left-style: none;" rowspan="2" idx="0">TS_Int_SW_SG_Secondary</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="1">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="2">00:00:00</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="3">4</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" rowspan="2" idx="4">6</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" colspan="3" idx="5"></td><td tabindex="-1" class="dojoxGridCell " role="gridcell" colspan="2" idx="6"></td></tr><tr><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="7">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="8">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="9">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="10">0</td><td tabindex="-1" class="dojoxGridCell " role="gridcell" style="width: 8%;" idx="11">0</td></tr></tbody></table></div></div></div>
    </div>
</div></div>
    <div class="dojoxGridMasterMessages" style="display: none;" dojoattachpoint="messagesNode"></div>
    <span tabindex="0" dojoattachpoint="lastFocusNode"></span>
</div></div>
        <div class="clear"></div>
    </div>

目标是获取dojoxGridCell中的值:

<td tabindex="-1" class="dojoxGridCell  dojoxGridCellFocus" role="gridcell" style="width: 8%;" rowspan="2" idx="3">5</td>

消息框总是返回空的。请帮助,我做错了什么?谢谢。

pu3pd22g

pu3pd22g1#

要从网格中获取单元格值,请尝试以下操作。
//假设我们要从第二行中获取第四个单元格的值

var item = grid.getItem(1); //The 2nd row 
if(item){  
    grid.getCell(3).get(1, item); //The 4th column, the 2nd row 
}

*****************更新的答案*******************请参见

http://jsfiddle.net/7NEEe/11/
我有一个提示,显示9.33作为答案。我已经硬编码的行号和单元格的数字,所以你总是看到9.33行点击。

相关问题