Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactions click dispatch #439

Merged
merged 6 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add column name to detail for click
  • Loading branch information
Joshua Hawkins committed Feb 20, 2019
commit 46d5ade4448d5bbee54e852a63f773bf37fdd6a0
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ function setColumnPropsByType(column) {
exports.install = function(grid) {
Object.getPrototypeOf(grid.behavior).setPSP = setPSP;

// column name, data row, config
Object.getPrototypeOf(grid.behavior).cellClicked = async function(event) {
event.primitiveEvent.preventDefault();
event.handled = true;
Expand All @@ -130,8 +129,10 @@ exports.install = function(grid) {
const column_index = row_pivots.length > 0 ? x + 1 : x;
const column_paths = Object.keys(r[0])[column_index];
let column_filters = [];
let column_name;
if (column_paths) {
const column_pivot_values = column_paths.split("|");
column_name = column_pivot_values[column_pivot_values.length - 1];
column_filters = column_pivots
.map((pivot, index) => {
const pivot_value = column_pivot_values[index];
Expand All @@ -148,6 +149,7 @@ exports.install = function(grid) {
composed: true,
detail: {
config: {filters},
column_name,
row: r[0]
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ utils.with_server({}, () => {
});
});

test.capture("perspective dispatches perspective-click event with the column name.", async page => {
const detail = await click_details(page);
expect(detail.column_name).toEqual("Order Date");
});

test.capture("perspective dispatches perspective-click event with NO filters.", async page => {
const detail = await click_details(page);
expect(detail.config).toEqual({filters: []});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@
"superstore.html/replaces all rows.": "2c41d623f03b2417da7b5dcf7f31e364",
"hypergrid.html/Dispatches perspective-click event with filters.": "3025f83c828d468207b04d8454e94fda",
"hypergrid.html/Dispatches perspective-click event with NO filters.": "f5d6bf82299b2e5f403cdb69b67645fe",
"hypergrid.html/Dispatches perspective-click event with one filter.": "b7a10ece1d5084742f9a2d88bb68984d"
"hypergrid.html/Dispatches perspective-click event with one filter.": "b7a10ece1d5084742f9a2d88bb68984d",
"hypergrid.html/perspective dispatches perspective-click event with the data row.": "f5d6bf82299b2e5f403cdb69b67645fe",
"hypergrid.html/perspective dispatches perspective-click event with NO filters.": "f5d6bf82299b2e5f403cdb69b67645fe",
"hypergrid.html/perspective dispatches perspective-click event with one filter.": "b7a10ece1d5084742f9a2d88bb68984d",
"hypergrid.html/perspective dispatches perspective-click event with filters.": "3025f83c828d468207b04d8454e94fda",
"hypergrid.html/perspective dispatches perspective-click event with the column name.": "f5d6bf82299b2e5f403cdb69b67645fe"
}