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

Offer easy way to disable detailRenderer #42

Open
danksch opened this issue Dec 11, 2018 · 7 comments
Open

Offer easy way to disable detailRenderer #42

danksch opened this issue Dec 11, 2018 · 7 comments

Comments

@danksch
Copy link

danksch commented Dec 11, 2018

I tried disabling the detailRenderer by setting detailRenderer={null}, which is an unexpected type and doesn't work. In the tutorial, I saw headerRenderer set to null once and thought this would work here as well.

How can I disable the item details ?

@jarekwg
Copy link
Member

jarekwg commented Dec 11, 2018

Maybe try passing in a blank renderer (have it return nothing in its render method)?

Also could you describe your use case a little for us (just curious)?

@DarioDiem
Copy link

Hi
I have the same question, in my case the user doesn't have the need of the item details since the table already contains all that the user needs.

how can I pass the blank renderer?
is there any example?

@DarioDiem
Copy link

DarioDiem commented Dec 19, 2018

Hi
I have the same question, in my case the user doesn't have the need of the item details since the table already contains all that the user needs.

how can I pass the blank renderer?
is there any example?

Answering my own question, just created a new Class which had the render() return what I wanted, either nothing or something that the users in my project would need and passed it as:

   <FileBrowser
     ...
     detailRenderer={MyRenderer}
     ...
   /> 

the class is something like this:

class MyRenderer extends React.Component {
  constructor(props) {
    super(props)
  }
  render() {
    return (
      <div>
        <p>something</p>
      </div>
    );
  }
}

export default MyRenderer;

@jarekwg
Copy link
Member

jarekwg commented Dec 19, 2018

Neat. I'll leave this open, as we'd probs like to offer a neater way of doing this in future.

@jarekwg jarekwg changed the title Disabling item details Offer easy way to disable detailRenderer Dec 19, 2018
@danksch
Copy link
Author

danksch commented Dec 20, 2018

Also could you describe your use case a little for us (just curious)?

I'm trying to implement a file browser with drag and drop functionality, where a user selects files/folders on a drive.

Maybe try passing in a blank renderer (have it return nothing in its render method)?

Yes, that's what I've one for now. Similar to @DarioDiem 's approach, I just passed a (functional) component which returns nothing:

function EmptyRenderer() { return ( <div></div> ) }

@ziaulrehman40
Copy link
Contributor

Well, this works:

detailRenderer={() => null}

I think this issue should be closed

@jlo-1
Copy link
Contributor

jlo-1 commented Jul 7, 2021

Closing due to suitable solutions above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants