Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Created item actions frozen column on right side #1340

Conversation

BenjaminNeilDavis
Copy link
Contributor

Fixes #1267

ex:

list_actions:  {
                        width: 50,
                        items: [
                            {
                                name: 'edit',
                                html: function () {
                                    return '<div class="fuelux-icon fuelux-icon-pencil"></div> Edit'
                                }
                            },
                            {
                                name: 'copy',
                                html: function () {
                                    return '<div class="fuelux-icon fuelux-icon-copy"></div> Copy'
                                }
                            },
                            {
                                name: 'delete',
                                html: function () {
                                    return '<div class="fuelux-icon fuelux-icon-delete"></div> Delete'
                                },
                                clickAction: function(helpers, callback) {
                                    console.log('hey it worked');
                                    console.log(helpers);
                                    callback();
                                }
                            }
                        ]
                    },

@kevinparkerson
Copy link
Contributor

Noticing the rows being off by about a pixel in Firefox, but not in Chrome. In IE 9 & 10, the rows don't have bottom borders present within the actions table. Going to be problematic getting this cross-browser, might need to add a small browser-sniffing utility function in the repeater-less.js file to add a class to target specific browsers. Attempt pure LESS first though

@@ -201,7 +300,8 @@
list_selectable: false,
list_sortClearing: false,
list_rowRendered: null,
list_frozenColumns: 0
list_frozenColumns: 0,
list_itemActions: false
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should call this option list_actions to simplify (replacing the name throughout the control). Then, I'd suggest making this accept an object vs an array. The object would have an items attribute, which would be the array of action items :) The reason for the object is I think we need other attributes here, such as label and width. Since the actions column, while fixed, is essentially an additional column, we need a means to set it's column label and width just like we have via the columns settings.

@kevinparkerson
Copy link
Contributor

We will essentially need to create an automatic additional column for actions if list_actions is set to an object. The reasoning for this is that if you have lots of content in the last column, it will be obscured by the actions column (try putting a paragraph of lorem ipsum for content in last column of the incoming data to see this currently). As such, the actions column needs to be an actual column on the repeater-list, with the fixed table positioned above it so that it does not scroll (similar to the floating columns on the left).

The settings for the additional column should be as follows:

{
    label: this.viewOptions.list_actions.label || '',
    property: '',
    sortable: false,
    width: (this.viewOptions.list_actions.width !== undefined) ? this.viewOptions.list_actions.width : {{defaultActionsWidth}}
}

This additional column should be added in renderThead. To prevent the differentColumns function from acknowledging this dynamically added column, add a line before line 470 in differentColumns that says var oldColsLength = (this.viewOptions.list_actions !== false) ? oldCols.length - 1 : oldCols.length;, then modify the conditional on line 473 to say if (!oldCols || (newCols.length !== oldColsLength)) {. Then, after line 610 where this.list_columns is set to columns, add the conditional if (this.viewOptions.list_actions !== false) { and within that add the above object to the end of this.list_columns. That should make the appropriate actions column so that the last column never goes beneath it. Because property is set to '' for the action column in the renderColumn function there is one other change needed before line 414: content = (content!==undefined) ? content : ''; This is to prevent unexpected results from adding content to a column, because for actions the property will not be found in the column definition and as such when it looks up the content for that particular item it will come back as undefined.

@kevinparkerson
Copy link
Contributor

Note: I modified my suggestions for the dynamic column in renderThead after realizing a potential issue.

@kevinparkerson kevinparkerson modified the milestones: 3.9.0, 3.8.0 Jun 11, 2015
@cmcculloh-kr
Copy link

Needs:

  • unit tests
  • dev examples (in /index.html and markup/)
  • documentation

@BenjaminNeilDavis
Copy link
Contributor Author

@CormacMcCarthy That is correct working on all of that now thanks!

@interactivellama interactivellama modified the milestone: 3.9.0 Jun 12, 2015
- Won't be adding documentation yet till multi select is completed and integrated.
- Added Unit tests
- Fixed remaining IE9 bugs
@kevinparkerson
Copy link
Contributor

@BenjaminNeilDavis Code looks good, still seeing some stylistic issues in Firefox involving the action column rows not aligning with the rest of the row. Might need to change that specialBrowserClass function to return the string of classes b-{{browser}} v-{{browserVersion}}, that way you could add those to the repeater wrapper and target Firefox specifically if you need to via b-firefox

also noticing an issue in Chrome where the actions column has a left border that is appearing above the repeater-list-heading

- Won't be adding documentation yet till multi select is completed and integrated.
- Added Unit tests
- Fixed remaining IE9 bugs
- Won't be adding documentation yet till multi select is completed and integrated.
- Added Unit tests
- Fixed remaining IE9 bugs
kevinparkerson pushed a commit that referenced this pull request Jun 23, 2015
…ction-frozen-column

Created item actions frozen column on right side
@kevinparkerson kevinparkerson merged commit c8e7c5a into ExactTarget:master Jun 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants