Skip to content

Instantly share code, notes, and snippets.

@joelwatson
Last active July 6, 2017 14:53
Show Gist options
  • Save joelwatson/c425e41682820ed3b60ea3b67247b65a to your computer and use it in GitHub Desktop.
Save joelwatson/c425e41682820ed3b60ea3b67247b65a to your computer and use it in GitHub Desktop.
Selecting grid row based on column name and value with Page Object
http://examples.sencha.com/extjs/6.5.0/examples/kitchensink/?classic#array-grid
var PO = {
grid: function () {
return ST.grid('grid');
},
selectByColumnText: function (text, value) {
return this.grid()
.execute(function (cmp) {
var columns = cmp.getVisibleColumns(),
dataIndex = null,
column;
for (var i=0; i<columns.length; i++) {
column = columns[i];
// here "text" is the argument for selectByColumnText()
if (column.text === text) {
dataIndex = column.dataIndex;
break;
}
}
return dataIndex;
})
.and(function () {
var future = this.future,
dataIndex = future.data.executeResult;
// here "value" is the argument for selectByColumnText()
future.selectWith(dataIndex, value);
});
}
};
it('should select row from column "text" and value', function () {
PO.selectByColumnText('Company', 'Twitterbeat');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment