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

How to size Custom Work Item Form Control (Dropdown) correctly? #45

Open
georgdrobny opened this issue Jan 11, 2022 · 5 comments
Open

Comments

@georgdrobny
Copy link

Hi,

I've implemented a custom work item form control which just consists of a simple drop-down. The drop down items are bound through code and all works as expected except for the size of the drop-down list. I can specify the size if the control in the extension manifest through the height property. The dropdown list with the available values is sized based on the height property. If the height value is large, the drop-down list is show shown also larger but this has the downside that a lot of empty space is reserved on the work item form for this control. If the value is low (for example 70, which should be sufficient for a simple drop-down) the drop-list is really small (just showing one item).
I can see other built in drop-down list on a work item form which are using minimal space and the drop-down list is expanded and shown as a nice list. I need to know how to achieve this behavior for my custom control as well. Do I need to place specific CSS classes on my HTML elements? I experimented with different styles but none of them seem have an effect. This is my current rendering code:
<div className="flex-item" style={{ margin: "8px", width: "99%"}}>

I tried "flex", "flex-box".
Any hints?
Thanks.
Georg

@FlexiGit
Copy link

You can calculated the required space from your extension and call
SDK.resize(undefiend, <yourheighthere>)
after opening and closing the dropdown.

@bangaruchary
Copy link

... in render()
<Dropdown
placeholder="Select a Value"
items={this.items}
onSelect={this.onSelect}
selection={this.selection}
onExpand={this.onExpand}
onCollapse={this.onCollapse}
/>
...

private onCollapse() {
  SDK.resize(undefined, 100)
};

private onExpand() {
  SDK.resize(undefined, 300)
};

I tried this one, but it still allocates lot of empty space in work item form. Am I missing something here.
Thank you.

@georgdrobny
Copy link
Author

georgdrobny commented Feb 11, 2022 via email

@bangaruchary
Copy link

Hi Georg

Yes, I did that change. Control just flashes and then closed. With those changes, its not event allowing us to select the values. It is always re-rendering.

--Chary

@bangaruchary
Copy link

bangaruchary commented Feb 14, 2022

Hi Georg

I am somewhat able to achieve the required functionality of auto resizing. Following are steps performed:

  1. Default height in the manifest json file is 50
  2. Added onExpand as mentioned in the previous note i.e. height to 200
  3. Removed onCollapse, as this is causing that dropdown is never loaded. Do not know the reasons for this behavior 
  4. Reducing the control height to 50 upon Item selection or valueUpdate

Issues:

  1. Upon first click, control is not completely expanded in layout. Subsequent clicks don't have any problem.
  2. Once a value is selected and if we re-click the dropdown field is getting expanded but never collapse until we select another/same value
    Can you please let us know at least how to fix these issues.

Thank you
Chary

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

No branches or pull requests

3 participants