Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions cypress/e2e/example-rtl.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@ describe('Example - RTL (Right-to-Left) Support', () => {
.children()
.each(($child, index) => expect($child.text()).to.eq(titles[index]));
});

it('should allow columns to be reordered in both directions in RTL mode', () => {
const reorderedTitles = [
'Title', '% Complete', 'Start', 'Finish', 'Duration', 'Effort Driven',
'Priority', 'Status', 'Assignee', 'Department', 'Project', 'Completed'
];

// Move Duration after Finish
cy.contains('#myGrid .slick-header-column', 'Finish').then(($target) => {
cy.contains('#myGrid .slick-header-column', 'Duration').drag($target);
});

cy.get('#myGrid').find('.slick-header-columns').children()
.each(($child, index) => expect($child.text()).to.eq(reorderedTitles[index]));

// Move Duration back
cy.contains('#myGrid .slick-header-column', '% Complete').then(($target) => {
cy.contains('#myGrid .slick-header-column', 'Duration').drag($target);
});

cy.get('#myGrid').find('.slick-header-columns').children()
.each(($child, index) => expect($child.text()).to.eq(titles[index]));
});
});

// Section 4: Scrolling Behavior
Expand Down
10 changes: 6 additions & 4 deletions examples/example1-simple-rtl.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>SlickGrid example 1: Basic grid (RTL)</title>
<link rel="stylesheet" href="../dist/styles/css/example-demo.css" type="text/css" />
<link rel="stylesheet" href="../dist/styles/css/slick-alpine-theme.css" type="text/css" />
</head>
</head>

<body>
<h2 class="title">Example 1 Simple Grid (RTL) - ESM</h2>
Expand All @@ -27,6 +27,7 @@ <h2>
<ul>
<li>basic grid with minimal configuration</li>
<li>RTL (right-to-left) support enabled</li>
<li>column reordering in RTL mode</li>
</ul>
<h2>View Source:</h2>
<ul>
Expand All @@ -38,7 +39,8 @@ <h2>View Source:</h2>
</tr>
</table>

<script src="https://cdn.jsdelivr.net/npm/sortablejs/Sortable.min.js"></script>
<!-- SortableJS RTL fork: required for column reordering in RTL mode. -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs-rtl/Sortable.min.js"></script>
<script src="sortable-cdn-fallback.js"></script>

<script src="../dist/browser/slick.core.js"></script>
Expand All @@ -49,7 +51,7 @@ <h2>View Source:</h2>
var grid;
var columns = [
{ id: "title", name: "Title", field: "title", width: 90 },
{ id: "duration", name: "Duration", field: "duration", with: 80 },
{ id: "duration", name: "Duration", field: "duration", width: 80 },
{ id: "%", name: "% Complete", field: "percentComplete", width: 90 },
{ id: "start", name: "Start", field: "start", width: 80 },
{ id: "finish", name: "Finish", field: "finish", width: 80 },
Expand All @@ -64,7 +66,7 @@ <h2>View Source:</h2>

var options = {
enableCellNavigation: true,
enableColumnReorder: false,
enableColumnReorder: true,
rtl: true
};

Expand Down
Loading