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

RTL direction jtable with rtl column resizable support added #1996

Closed
wants to merge 21 commits into from
Closed

RTL direction jtable with rtl column resizable support added #1996

wants to merge 21 commits into from

Conversation

sheryever
Copy link
Contributor

Resizable column support added for right to left direction languages like: Arabic, Urdu etc.

User just need to set a new option rtl: true table direction will be change and column resizing will also support RTL direction.

dev/jquery.jtable.dynamiccolumns.js, all required css and less files updated.

@hikalkan hikalkan added this to the v2.5.0 milestone Oct 9, 2016
@hikalkan
Copy link
Member

hikalkan commented Oct 9, 2016

Thank you for the contribution. I'll review it soon.

The code is optimized. In last code of this file, I just created one extra chunk code to avoid any kind of code conflict.

In this commit the same code of jtable 2.4.0 is just tweaked to support rtl.

these line added.
```Javascript
            if (self.options.rtl) {
                self._$mainContainer.parent().attr('dir', "rtl");
            }
```
these line updated
```javascript
                        var currentColumnNewWidth = (self.options.rtl ? self._currentResizeArgs.currentColumnStartWidth - mouseChangeX : self._currentResizeArgs.currentColumnStartWidth + mouseChangeX);
                        var currentColumnFinalWidth = self._normalizeNumber(columnNewWidth, self._currentResizeArgs.minWidth, self._currentResizeArgs.maxWidth)
                        //var currentColumnFinalWidth = self._normalizeNumber(self._currentResizeArgs.currentColumnStartWidth + mouseChangeX, self._currentResizeArgs.minWidth, self._currentResizeArgs.maxWidth);
```
@sheryever
Copy link
Contributor Author

RTL column resizable direction optimized

The code is optimized. In last code of this file, I just created one extra chunk code to avoid any kind of code conflict.

In this commit the same code of jtable 2.4.0 is just tweaked to support rtl.

these line added.

            if (self.options.rtl) {
                self._$mainContainer.parent().attr('dir', "rtl");
            }

these line updated

                        var currentColumnNewWidth = (self.options.rtl ? self._currentResizeArgs.currentColumnStartWidth - mouseChangeX : self._currentResizeArgs.currentColumnStartWidth + mouseChangeX);
                        var currentColumnFinalWidth = self._normalizeNumber(columnNewWidth, self._currentResizeArgs.minWidth, self._currentResizeArgs.maxWidth)
                        //var currentColumnFinalWidth = self._normalizeNumber(self._currentResizeArgs.currentColumnStartWidth + mouseChangeX, self._currentResizeArgs.minWidth, self._currentResizeArgs.maxWidth);

@mohammed-alsiddeeq
Copy link

mohammed-alsiddeeq commented Nov 14, 2016

@hikalkan ٍ@sheryever wouldn't it be better if the rtl is automatically set?
i.e just checking if the dir html atttribute is set to rtl by using

 document.dir

then apply right to left specs

@sheryever
Copy link
Contributor Author

@mosid in the start i was doing that but in my own application, there are some scenario where i need LTR jtable in RTL page.

But you can do something like $.hik.jtable.prototype.options.rtl = (document.dir == "rtl" ? true : false) in the first line of you javascript.

@hikalkan I am sorry. I want to close this pull request and create another pull request which will have the complete rtl css with one commit. this pull request only have column header css while there are some other elements which are required to be fixed. Header resizing also have a minor issue, that header resize limit is calculated from left column which is wrong.

Questing: Do i really need to fix the css in all css files in the github source code, while we have the less files in our code?

I will prefer the less file with a jtable_theme_base_rtl.less then include the file in jtable_theme_base.less.

@sheryever sheryever closed this Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants