首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ext.net RTL不工作

ext.net RTL不工作
EN

Stack Overflow用户
提问于 2016-06-24 16:57:10
回答 1查看 269关注 0票数 0

我正在尝试开发一个使用波斯语的EXT.net .my语言的用户界面,所以我必须编程我们的项目从右到左。

我在ext.net中找到了这个来设置RTL

代码语言:javascript
复制
The RTL property can be set in several locations, including on the Viewport with RTL="true". We’ve also done the extra work to add as a Global property, and set in any of the following locations:

    at the Page level using <ext:ResourceManager RTL="true" />
    at the Application level using Web.config <extnet rtl="true" />
    in the Session using this.Session["Ext.Net.RTL"] = true;
    in the HttpContext using HttpContext.Current.Application["Ext.Net.RTL"] = true;

但是它不能工作,.why?

下面是我的代码:

代码语言:javascript
复制
@using Ext.Net;
@using Ext.Net.MVC;

@model System.Collections.IEnumerable

@{
    Layout = null;
    var X = Html.X();
}
<ext:ResourceManager RTL="true" />
<!DOCTYPE html>
<html>
<head>
    <title>Ext.NET MVC Sample</title>    
    <script>
        var template = 'color:{0};';

        var change = function (value, meta) {
            meta.style = Ext.String.format(template, (value > 0) ? "green" : "red");
            return value;
        };

        var pctChange = function (value, meta) {
            meta.style = Ext.String.format(template, (value > 0) ? "green" : "red");
            return value + "%";
        };

        var edit = function (editor, e) {
            /*
                "e" is an edit event with the following properties:

                    grid - The grid
                    record - The record that was edited
                    field - The field name that was edited
                    value - The value being set
                    originalValue - The original value for the field, before the edit.
                    row - The grid table row
                    column - The grid Column defining the column that was edited.
                    rowIdx - The row index that was edited
                    colIdx - The column index that was edited
            */

            // Call DirectMethod
            if (!(e.value === e.originalValue || (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
                Ext.net.DirectMethod.request({
                    url: '@(Url.Action("Edit"))',
                    params: {
                        id: e.record.data.ID,
                        field: e.field,
                        oldValue: e.originalValue,
                        newValue: e.value,
                        customer: e.record.data
                    }
                });
            }
        };
    </script>
    <link type="text/css" rel="stylesheet" href="http://speed.ext.net/www/intro/css/main.css" />
</head>
<body>
    @(Html.X().ResourceManager())

    <header>
        <a href="http://ext.net/"><img src="http://speed.ext.net/identity/extnet-logo-large.png" class="logo"/></a>
    </header>

    <ext:ResourceManager RTL="true" />
    @(Html.X().GridPanel()
        .Title("لیست کاربران")
        .Width(600)
        .Height(350)
        .Store(Html.X().Store()
            .ID("Store1")
            .Model(Html.X().Model()
                .IDProperty("ID")
                .Fields(
                    new ModelField("ID", ModelFieldType.Int),
                    new ModelField("Name"),
                    new ModelField("Price", ModelFieldType.Float),
                    new ModelField("Change", ModelFieldType.Float),
                    new ModelField("PctChange", ModelFieldType.Float),
                    new ModelField("LastChange", ModelFieldType.Date)
                )
            )
            .DataSource(Model)
        )
        .ColumnModel(
            Html.X().Column().Text("ID").DataIndex("ID").Width(35),
            Html.X().Column()
                .Text("Name")
                .DataIndex("Name")
                .Flex(1)
                .Editor(Html.X().TextField()),
            Html.X().Column()
                .Text("Price")
                .DataIndex("Price")
                .Renderer(RendererFormat.UsMoney)
                .Editor(Html.X().NumberField()),
            Html.X().Column()
                .Text("Change")
                .DataIndex("Change")
                .Renderer("change")
                .Editor(Html.X().NumberField()),
             Html.X().Column()
                .Text("PctChange")
                .DataIndex("PctChange")
                .Renderer("pctChange")
                .Editor(Html.X().NumberField()),
            Html.X().DateColumn()
                .Text("Last Updated")
                .DataIndex("LastChange")
                .Format("yyyy-MM-dd")
                .Editor(Html.X().DateField().Format("yyyy-MM-dd"))
        )
        .SelectionModel(Html.X().CellSelectionModel())
        .Plugins(
            Html.X().CellEditing().Listeners(ls => ls.Edit.Fn = "edit")
        )
    )


    @(X.Button()
        .Text("Show Window")
        .Icon(Icon.Application)
        .Handler("App.Window1.show(this);")
    )

    @(X.Window()
        .ID("Window1")
        .Title("Ext.NET")
        .Width(1000)
        .Height(500)
        .Modal(true)
        .AutoRender(false)
        .Collapsible(true)
        .Maximizable(true)
        .Hidden(true)
        .Loader(X.ComponentLoader()
            .Url("http://www.spadsystem.com")
            .Mode(LoadMode.Frame)
            .LoadMask(lm => lm.ShowMask = true)
        )
    )

</body>
</html>

结果

EN

回答 1

Stack Overflow用户

发布于 2016-06-26 20:44:58

您需要在web.config中启用RTL

代码语言:javascript
复制
<extnet rtl="True"/>

并为网格本身启用RTL

代码语言:javascript
复制
Html.X().GridPanel().RTL(true)
    .Title("لیست کاربران")
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38009359

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档