2011-11-22 81 views
0

我正在使用SlickGrid,但我想用它與阿拉伯語,它需要從右向左的方向。如何從右向左製作SlickGrid?

columns[0]={'id':'title', 'name':'Title', 'field':'title', 'width': 10, 'sortable': true}; 
columns[1]={'id':'name', 'name':'Name', 'field':'name', 'width': 10, 'sortable': true}; 

var grid, data = [], 
options = { 
    enableCellNavigation: true, 
    enableColumnReorder: true, 
    autoHeight: true 
}, numberOfItems = 5, items = [], indices=[], isAsc = true, currentSortCol = { id: "title" };  
grid = new Slick.Grid("#container", data, columns, options); 

例如參見圖片: http://i.stack.imgur.com/mbmaY.png

如何我SlickGrid實現這一目標?

+0

究竟你想成爲rtl?你想以不同的順序列? – njr101

+0

我想讓網格從右側開始(反射網格),即(第一個網格列從右側開始,水平滾動條從右側開始)。是的,像rtl在Html –

+0

當然,我錯過了一些東西,但爲什麼不只是以相反的順序傳遞列和數據數組? – vemv

回答

-1

我認爲這可以使用瀏覽器中的內置RTL渲染來從右向左渲染標記。

HTML

<div dir="rtl" id="myGrid" style="width:400px;height:150px;">  
</div> 

的Javascript

columns.reverse(); 
grid = new Slick.Grid("#myGrid", data, columns, options); 

jsFiddle here

正如你可以在小提琴看到,在div呈現RTL正如人們所預料,但似乎有與問題呈現列標題。我沒有深入研究代碼,但也許存在一些與RTL設置衝突的絕對定位或其他技巧。不知道有多少其他功能可能會導致問題(單元格編輯器,格式化程序等)

+0

基本上,當我嘗試方向=「rtl」時,我遇到了與標題相同的意外結果。非常感謝。 –