我正在尝试在波斯语中使用EXT.net .my语言开发UI,所以我必须从右到左编程我们的项目。
我发现这是在ext.net中设置RTL
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;
但它没有用。为什么?
这是我的代码:
@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>
结果
答案 0 :(得分:1)
您需要在web.config中启用RTL
<extnet rtl="True"/>
为网格本身启用RTL
Html.X().GridPanel().RTL(true)
.Title("لیست کاربران")