PDA

View Full Version : use excel vba to select an item in a Kendo grid in IE



mamalmgren
03-25-2017, 02:02 PM
I've run into a brick wall. I'm trying to make a selection in Kendo grid table, and so far, everything I've tried doesn't work.
I can do everything else, ie: fill text boxes, click submit buttons using getElementById etc. I just can't get choose something
in the grid, or select an item from a dropdown.
This is what I see when I inspect the element: I want to select the name in Blue. So far, the only way to select it, is with a mouse.
I've tried: ie.document.getElementById, ie.document.getElementsByName, ie.document.getElementsByTag,
Any help would be appreciated
Thanks
Mitch

This is what our internal web page looks like after entering a lease number (998262) and searching.
The normal way to select, is to click with the mouse in any of the 3 "white" areas.
18771

Javascript code (looking at "Inspect Element")

<div name="Result">
<div class="k-widget k-grid" id="drgdLease" style="-ms-touch-action: double-tap-zoom pinch-zoom;" data-role="grid">
<div class="k-grouping-header" style="-ms-touch-action: double-tap-zoom pinch-zoom;" data-role="droptarget">Drag a column header and drop it here to group by that column</div>
<table class="k-selectable" role="grid" style="-ms-touch-action: double-tap-zoom pinch-zoom;" data-role="selectable"><colgroup><col><col><col></colgroup>
<thead class="k-grid-header" role="rowgroup">
<tr role="row">
<th class="k-header k-with-icon" scope="col" data-title="Lease Number" data-index="0" data-field="LeaseCode" data-role="columnsorter">
<a tabindex="-1" class="k-header-column-menu" href="#">
<span class="k-icon k-i-arrowhead-s"></span>
</a>
<a class="k-link" href="/LeaseProfiles/GetLeasesSearch?Length=9&amp;drgdLease-sort=LeaseCode-asc">Lease Number</a></th>
<th class="k-header k-with-icon" scope="col" data-title="Lease Name" data-index="1" data-field="LeaseName" data-role="columnsorter">
<a tabindex="-1" class="k-header-column-menu" href="#">
<span class="k-icon k-i-arrowhead-s"></span></a>
<a class="k-link" href="/LeaseProfiles/GetLeasesSearch?Length=9&amp;drgdLease-sort=LeaseName-asc">Lease Name</a></th>
<th class="k-header k-with-icon" scope="col" data-title="Lease Operator" data-index="2" data-field="LeaseOperator.OperatorName" data-role="columnsorter">
<a tabindex="-1" class="k-header-column-menu" href="#">
<span class="k-icon k-i-arrowhead-s"></span></a>
<a class="k-link" href="/LeaseProfiles/GetLeasesSearch?Length=9&amp;drgdLease-sort=LeaseOperator.OperatorName-asc">Lease Operator</a></th></tr></thead> <tbody role="rowgroup">
<tr role="row" data-uid="c87852d5-a3d5-4dd4-98a6-3988e44e4046">
<td role="gridcell">998262</td>
<td role="gridcell">HENDERSON (SMACKOVER) STORAGE</td>
<td role="gridcell">ORYAN OIL &amp; GAS</td></tr>
</tbody>
</table>
<div class="k-pager-wrap k-grid-pager k-widget" data-role="pager">
<a tabindex="-1" title="Go to the first page" class="k-link k-pager-nav k-state-disabled k-pager-first" href="#" data-page="1">
<span class="k-icon k-i-seek-w">seek-w</span></a>
<a tabindex="-1" title="Go to the previous page" class="k-link k-pager-nav k-state-disabled" href="#" data-page="1"><span class="k-icon k-i-arrow-w">arrow-w</span></a>
<ul class="k-pager-numbers k-reset"><li><span class="k-state-selected">1</span></li></ul><a tabindex="-1" title="Go to the next page" class="k-link k-pager-nav k-state-disabled" href="#" data-page="1"><span class="k-icon k-i-arrow-e">arrow-e</span></a>
<a tabindex="-1" title="Go to the last page" class="k-link k-pager-nav k-state-disabled k-pager-last" href="#" data-page="1"><span class="k-icon k-i-seek-e">seek-e</span></a><span class="k-pager-sizes k-label"><span tabindex="0" class="k-widget k-dropdown k-header" role="listbox" aria-busy="false" aria-disabled="false" aria-expanded="false" aria-haspopup="true" aria-readonly="false" aria-owns="" unselectable="on"><span class="k-dropdown-wrap k-state-default" unselectable="on"><span class="k-input" unselectable="on">20</span><span class="k-select" unselectable="on"><span class="k-icon k-i-arrow-s" unselectable="on">select</span></span></span><select style="display: none;" data-role="dropdownlist"><option value="5">5</option><option value="10">10</option><option selected="selected" value="20">20</option></select></span>Leases per page</span><a title="Refresh" class="k-pager-refresh k-link" href="/LeaseProfiles/GetLeasesSearch?Length=9"><span class="k-icon k-i-refresh">Refresh</span></a><span class="k-pager-info k-label">Leases 1 - 1. Total Lease(s):1</span></div></div>
<script>
jQuery(function(){jQuery("#drgdLease").kendoGrid({"dataBound":drgdLeaseDataBound,"change":drgdLeaseChange,"columns":[{"title":"Lease Number","field":"LeaseCode","filterable":{},"encoded":true},{"title":"Lease Name","field":"LeaseName","filterable":{},"encoded":true},{"title":"Lease Operator","field":"LeaseOperator.OperatorName","filterable":{},"encoded":true}],"groupable":{},"pageable":{"autoBind":false,"refresh":true,"pageSizes":[5,10,20],"buttonCount":10,"messages":{"display":"Leases {0} - {1}. Total Lease(s):{2}","empty":"No Lease to display","itemsPerPage":"Leases per page"}},"sortable":true,"selectable":"Single, Row","columnMenu":true,"scrollable":false,"autoBind":false,"dataSource":{"type":(function(){if(kendo.data.transports['aspnetmvc-ajax']){return 'aspnetmvc-ajax';} else{throw new Error('The kendo.aspnetmvc.min.js script is not included.');}})(),"transport":{"read":{"url":"/LeaseProfiles/GetLeasesSearch","data":leaseSearchData},"prefix":""},"pageSize":20,"page":1,"total":0,"serverPaging":true,"serverSorting":true,"serverFiltering":true,"serverGrouping":true,"serverAggregates":true,"filter":[],"error":OnError,"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"fields":{"LeaseType":{"type":"number","defaultValue":null},"LeaseCode":{"type":"string"},"LeaseName":{"type":"string"},"LeaseDistrict":{"type":"object"},"OriginalDistrict":{"type":"object"},"Destination":{"type":"object"},"LeaseOperator":{"type":"object"},"SulfurPercent":{"type":"number","defaultValue":null},"State":{"type":"object"},"County":{"type":"object"},"QuickPayCode":{"type":"string"},"IsSevered":{"type":"boolean","defaultValue":null},"Status":{"type":"number"},"DataLoadDate":{"type":"date","defaultValue":null},"SiteCode":{"type":"string"},"StartDate":{"type":"date","defaultValue":null},"EndDate":{"type":"date","defaultValue":null},"InXata":{"type":"boolean"},"IsTract":{"type":"boolean"}}}}}});});
</script>
</div>