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

Selection column on the right-hand side (non-RTL) #4862

Closed
Robinson7D opened this issue Dec 15, 2015 · 8 comments
Closed

Selection column on the right-hand side (non-RTL) #4862

Robinson7D opened this issue Dec 15, 2015 · 8 comments

Comments

@Robinson7D
Copy link
Contributor

Is it possible to have the selection column on the right side, rather than the left? Everything else would be expected to be LTR, just the selection on the right.

I've looked into the code a bit and noticed that the column is added by calling:
uiGridCtrl.grid.addRowHeaderColumn(selectionRowHeaderDef);

And a snippet from addRowHeaderColumn includes:

Grid.prototype.addRowHeaderColumn = function addRowHeaderColumn(colDef) {
    var self = this;
    var rowHeaderCol = new GridColumn(colDef, gridUtil.nextUid(), self);
    rowHeaderCol.isRowHeader = true;
    if (self.isRTL()) {
      self.createRightContainer();
      rowHeaderCol.renderContainer = 'right';
    }
    else {
      self.createLeftContainer();
      rowHeaderCol.renderContainer = 'left';
    }
    // ... more code
}

If it's not currently possible, this seems like it would be simple to fix, and I would be happy to provide a PR unless y'all believe this to be a bad feature or bad fix.

The way I would approach it would be to add a second arg to addRowHeaderColumn (either a Boolean/String that just represents the side, or a second Object that holds metadata for adding). After that the if (self.isRTL()) would also check if that's not defined as "left" (or true?). Finally an option would be checked in the uiGridSelectionService precompile function, which can check an option in uiGridCtrl.grid.options.

As I mentioned, this is super simple to implement - all in, that's like 3 lines of code changed, only one added to support this.

Any thoughts? Would there be any interest in a PR?

@imbalind
Copy link
Contributor

I think the point is: would this be worth the extra parameter and more complex code? The answer should depend on how many people has this need.

I'm not an expert in the container system, but isn't it possible to add a container programmatically? If it was, you could build your own solution without editing the library.

Anyhow I'll leave this open so other people can let us know if this is needed.

@Robinson7D
Copy link
Contributor Author

Yep, I totally agree (and acknowledged that in the original post in "unless (you) believe this to be a bad feature").

As for performing this programatically, it might be possible, but I suspect it would be pretty hacky. I believe enabling selection at all forces you to have the column, so my options there would be either roll my own multi-select and integrate it over the rows (bad idea given the number of little things this does), or set selectionRowHeaderWidth to 0 (which feels like a bad idea as well.)
After that I'd still have to duplicate a bunch of the code from the grid's internal API.

But again, I will concede that the vast majority of row selections are on the left side, so the added code-complexity of adding an argument to the function may not be worth it. In fact, if it were a significantly larger required change then I wouldn't even consider it.

@shashankGopannagari
Copy link

Hello @Robinson7D ,

I tooo want selection column on the right side.
could any body help me on this.?

@Robinson7D
Copy link
Contributor Author

Robinson7D commented May 2, 2016

Hi @shashankGopannagari,

I convinced the designer for my project that (for us, like most others) it should be on the left side; and so I haven't followed this any further.

@shashankGopannagari
Copy link

@Robinson7D Hahaha . Ok but if u have any idea could you share the solution

@TimHarker
Copy link

I vote to treat this column, and the treeview column, just like any other column and thus you can specify the order in columnDefs.

@stale
Copy link

stale bot commented May 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 23, 2018
@stale
Copy link

stale bot commented Jun 22, 2018

This issue has been automatically closed because it has not had recent activity. If you believe that this is still an issue in the latest version, feel free to re-open it. Thank you for your contributions.

@stale stale bot closed this as completed Jun 22, 2018
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

4 participants