Skip to content

Conversation

@jeff-phillips-18
Copy link
Member

This adds a dropdown menu button to the far right of the items in the data list if actions are provided to the pfDataList directive.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructing HTML using javascript is difficult to read and maintain and is somewhat of an AngularJS anti-pattern. We should be using angular-bootstrap's dropdown directive, wrapping it with modifications if desired.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with that is that it would create the dropdown for every item in the list. I did this so that the dropdown menu was only created when the item was selected. If there are 1000's of rows the performance would suffer creating all these menus.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with that is that it would create the dropdown for every item in the list.

What about using ng-if and the aforementioned directive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea I hadn't thought of. I will do that and see how it goes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That worked well and simplified the unit tests greatly. Thanks!

@waldenraines
Copy link

Should we use absolutely position the dropdown? See the dropdown barely visible at the bottom of the attached screenshot.

screen shot 2015-09-21 at 11 45 53 am

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we have a style for this now

duh, right 😊

@dtaylor113
Copy link
Member

LGTM

@waldenraines
Copy link

Should we use absolutely position the dropdown? See the dropdown barely visible at the bottom of the attached screenshot.

@jeff-phillips-18 thoughts on this?

@jeff-phillips-18
Copy link
Member Author

@waldenraines Yeah, I agree and I'm working on it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect chance to save some bytes #222 :)

@jeff-phillips-18
Copy link
Member Author

@waldenraines I've got it working. The only issue I'm seeing is that the dropdown menu will stay put if you scroll the window while it is up. That is, if I click the link button to see the menu, then I use the wheelie mouse to scroll the page, the dropdown menu does not move with the item it was displayed for. Any thoughts? Acceptable?

@erundle
Copy link

erundle commented Sep 21, 2015

This solution is going to have problems if the menu is rendered near the bottom of the page.
screen shot 2015-09-21 at 2 35 33 pm

@erundle
Copy link

erundle commented Sep 21, 2015

lol nm looks like @waldenraines is already on it.

@erundle
Copy link

erundle commented Sep 21, 2015

We need to have logic that figures out if it is close to the bottom of the page and if so have it show up and not down.

@waldenraines
Copy link

The only issue I'm seeing is that the dropdown menu will stay put if you scroll the window while it is up. That is, if I click the link button to see the menu, then I use the wheelie mouse to scroll the page, the dropdown menu does not move with the item it was displayed for. Any thoughts? Acceptable?

This isn't yet committed is it? I was going to test this out to see it in action but I still see the same behavior.

If I understand correctly, I wonder if we should just close any open dropdowns on scroll?

@jeff-phillips-18
Copy link
Member Author

I have not yet pushed. I will so you can see what I mean.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of ul use .dropdown-menu it is more performant

@waldenraines
Copy link

The only issue I'm seeing is that the dropdown menu will stay put if you scroll the window while it is up. That is, if I click the link button to see the menu, then I use the wheelie mouse to scroll the page, the dropdown menu does not move with the item it was displayed for. Any thoughts? Acceptable?

This isn't yet committed is it? I was going to test this out to see it in action but I still see the same behavior.

If I understand correctly, I wonder if we should just close any open dropdowns on scroll?

@jeff-phillips-18 yeah I think closing the menu on scroll would be the best bet here. I am open to other suggestions though.

@erundle
Copy link

erundle commented Sep 21, 2015

So what happens if the data list is wider than the space that is available. Does the page scroll, datalist wrapper? Do we just lose the actions menu?

@jeff-phillips-18
Copy link
Member Author

Yeah, I think closing the menu on scroll is the best option as well. Just added a commit for that. If the list scrolls or the window scrolls, the menu is hidden.

I will squash commits when ready before merge.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$compile is no longer used.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one still isn't used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@waldenraines
Copy link

So what happens if the data list is wider than the space that is available. Does the page scroll, datalist wrapper? Do we just lose the actions menu?

@jeff-phillips-18 what about @erundle's concern?

@jeff-phillips-18
Copy link
Member Author

@erundle @waldenraines Data list is designed to not scroll horizontally. That is the pattern's design.

@jeff-phillips-18
Copy link
Member Author

Squashed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I am looking at this directive in self-service and we are using class="row" too much. Everytime that is used we get margin: 0 -20px. This is causing scrollbars. Please only use the class of row if it is directly inside a container or container-fluid div

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case, row is needed as we use the margin areas for the checkbox and actions menu.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok well this margin pulls things closer to the edge of the page. The way you have things currently structured is you are making this element wider than the containing parent div. Maybe your PR will address this but if not we need to look at restructuring somethings. Just putting overflow-x:hidden isn't the solution. We need to stop it from growing wider than its container to begin with.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add this: .data-list-pf .list-group-item { padding: 10px 0 }; and remove the row class from that line things seem to render better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you doing something different in your parent container? Making this change causes the list example in ngdoc unreadable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I found the issue and removed the row class. Thanks @erundle !

@jeff-phillips-18
Copy link
Member Author

@erundle Are you ok with that change?

@erundle
Copy link

erundle commented Sep 24, 2015

Yes will merge

erundle pushed a commit that referenced this pull request Sep 24, 2015
Add ability to have actions pulldown menu in pfDataList directive
@erundle erundle merged commit e8720de into patternfly:master Sep 24, 2015
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

Successfully merging this pull request may close these issues.

4 participants