From 12dc4117c9384481b51fa3f8de94879f00d827f0 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Wed, 23 May 2018 16:15:24 -0700 Subject: [PATCH 1/6] Add support for custom props for rows in EuiBasicTable and EuiInMemoryTable. --- src-docs/src/views/tables/basic/basic.js | 14 +- .../src/views/tables/basic/basic_section.js | 6 +- src-docs/src/views/tables/data_store.js | 2 +- .../__snapshots__/basic_table.test.js.snap | 79 ++++++----- src/components/basic_table/basic_table.js | 3 + .../basic_table/basic_table.test.js | 133 +++++++++--------- 6 files changed, 131 insertions(+), 106 deletions(-) diff --git a/src-docs/src/views/tables/basic/basic.js b/src-docs/src/views/tables/basic/basic.js index 7c87de57b45..ba76e3399e6 100644 --- a/src-docs/src/views/tables/basic/basic.js +++ b/src-docs/src/views/tables/basic/basic.js @@ -80,9 +80,21 @@ export const Table = () => { } }]; + const items = store.users.filter((user, index) => index < 10).map(user => { + const { id } = user; + return { + ...user, + __props__: { + 'data-test-subj': `row-${id}`, + className: 'customClass', + onClick: () => console.log(`Clicked row ${id}`), + }, + }; + }); + return ( index < 10)} + items={items} columns={columns} /> ); diff --git a/src-docs/src/views/tables/basic/basic_section.js b/src-docs/src/views/tables/basic/basic_section.js index 166659ed0c2..419cbfa3ec0 100644 --- a/src-docs/src/views/tables/basic/basic_section.js +++ b/src-docs/src/views/tables/basic/basic_section.js @@ -31,8 +31,10 @@ export const section = {