@(Html.EJ().Grid<Sample118577.OrdersView>("FlatGrid")
-------------------------------------
.Columns(col =>
{
------------------------
col.Field("CustomerID").HeaderText("Customer ID").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).TextAlign(TextAlign.Left).Width(90).ValidationRules(v => v.AddRule("required", true)).Add();
------------------------------------
})
)
<script>
function create() {
return "<textarea>{{:CustomerID}}</textarea>";
}
function read(args) {
return args.val();
}
-------------
</script>
|
function create() {
return "<textarea class='text' >{{:CustomerID}}</textarea>";
}
function write(args) {
$('.text').css("max-width", args.element.parent("td").width());
$('.text').css("max-height", args.element.parent("td").height());
null;
}
|
@(Html.EJ().Grid<object>("FlatGrid")
------------------------------
.Columns(col =>
{
----------------------------
})
)
<script>
function create() {
return "<textarea class='text'>{{:CustomerID}}</textarea>";
}
function read(args) {
return args.val();
}
function write(args) {
------------------------------------
$('.text').resizable({
resize: function (e) {
var grid = $("#FlatGrid").ejGrid("instance");
var colgroup = grid.element.find("colgroup");
var width = parseInt(this.style.width) - grid.model.columns[2].width;
for (var i = 0 ; i < colgroup.length ; i++) {
$($(colgroup[i]).children()[1]).css("width", width);
}
}
});
} |
<link rel="stylesheet" rel='nofollow' href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" />
-------------------------------------------------
|
$('.text').resizable({
resize: function (e) {
var grid = $("#FlatGrid").ejGrid("instance");
var colgroup = grid.element.find("colgroup");
var width = parseInt(this.style.width) - grid.model.columns[1].width;
for (var i = 0 ; i < colgroup.length ; i++) {
$($(colgroup[i]).children()[1]).css("width", width);
}
}
});
|
$('.text').resizable({
resize: function (e) {
var grid = $("#FlatGrid").ejGrid("instance");
var colgroup = grid.element.find("colgroup");
var index = $(this.parentElement).index();
var width = parseInt(this.style.width) - grid.model.columns[index].width;
for (var i = 0 ; i < colgroup.length ; i++) {
$($(colgroup[i]).children()[index]).css("width", width);
}
}
}); |