@Grid
@{Html.EJ().Grid<object>("FlatGrid")
. . .
.AllowPaging()
.ClientSideEvents(eve => { eve.ActionComplete("complete").ActionBegin("begin"); })
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.ExternalFormTemplate).InlineFormTemplateID("#ExternalTemplate"); })
})
.Columns(col =>
{
col.Field("CustomerID").HeaderText("Customer ID").ClipMode(ClipMode.Ellipsis).Width(80).Add();
. . .
}).Render();
}
<script id="ExternalTemplate" type="text/template">
<b>Order Details</b>
<table cellspacing="10">
<tr>
. . .
</tr>
</table>
CustomerID:
<textarea id="RTE" rows="5" cols="30" style="width: 400px; height: 150px"> {{:CustomerID}}</textarea>
</script>
<script>
function complete(args) {
if (args.requestType == "beginedit")
$("#RTE").ejRTE(); // Rendering RTE
}
</script>
|
I was able to get the RTE in the custom form. The only problem I have is that it is not using the full with of the table:
<script id="template" type="text/template">
<table cellspacing="10" style="width:100%">
<tr>
<td>Employee ID</td>
<td>
<input id="EmployeeID" name="EmployeeID" disabled="disabled" value="{{:EmployeeID}}" class="e-field e-ejinputtext" style="width:116px;height:28px" />
</td>
<td>Name</td>
<td>
<input id="Name" name="Name" value="{{:Name}}" class="e-field e-ejinputtext" style="width: 116px; height: 28px" />
</td>
<td>Employee ID</td>
<td>
<input type="text" id="LastName" name="LastName" value="{{:LastName}}" />
</td>
</tr>
<tr>
<td>DOB</td>
<td>
<input type="text" id="DOB" name="DOB" value="{{:DOB}}" />
</td>
<td>Department</td>
<td colspan="3">
<select id="DepartmentID" name="DepartmentID">
<option value="Calims">Claims</option>
<option value="Network Management">Network Management</option>
</select>
</td>
</tr>
<tr>
<td colspan="6">
Comments<br/>
<textarea id="RTE"> {{:Resume}}</textarea>
</td>
</tr>
</table>
</script>
I tried this but not working:
<script>
function complete(args) {
$("#EmployeeID").ejNumericTextbox();
$("#Name").ejNumericTextbox();
$("#LastName").ejNumericTextbox();
$("#DOB").ejNumericTextbox();
$("#Department").ejDropDownList();
}
function complete2() {
$("#RTE").ejRTE();
$("#RTE").width= "100 %";
}
</script>
function complete2() {
$("#RTE").ejRTE({ width: "100%" });
}
|
I still have two issues in the code below:
<script>
function complete(args) {
$("#EmployeeID").ejNumericTextbox();
$("#Name").ejNumericTextbox();
$("#LastName").ejNumericTextbox();
$("#DOB").ejNumericTextbox();
if (args.requestType == "beginedit") {
$("#DepartmentID").ejDropDownList("setSelectedValue", args.row.children().eq(5).text());
}
}
function complete2(args) {
$("#RTE").ejRTE({ width: "100%" });
}
</script>
when I save: all the fields are being saved, except the value in the RTE (rich text box).
The selected value of the department is not getting selected when it opens the custom form: the code below is not working:
$("#DepartmentID").ejDropDownList("setSelectedValue", args.row.children().eq(5).text());
Please advise.
if (args.requestType == "beginedit") {
$("#DepartmentID").ejDropDownList("setSelectedValue", args.row.children().eq(4).text());
}
|
I am attaching a sample file with the code. The issue is in the code below:
<script>
function complete(args) {
$("#EmployeeID").ejNumericTextbox();
$("#Name").ejNumericTextbox();
$("#LastName").ejNumericTextbox();
$("#DOB").ejNumericTextbox();
}
function complete2(args) {
$("#RTE").ejRTE({ width: "100%" });
if (args.requestType == "beginedit") {
$("#DepartmentID").ejDropDownList("setSelectedValue", args.row.children().eq(4).text());
}
}
</script>
In the line: $("#DepartmentID").ejDropDownList("setSelectedValue", args.row.children().eq(4).text()); I get the following error:
Thanks
<script>
function complete(args) {
if (args.requestType == "beginedit") {
$("#CustomerID").ejRTE({ width: "100%" });
$("#EmployeeID").ejDropDownList({ width: '116px' });
$("#EmployeeID").ejDropDownList("setSelectedText", args.row.children().eq(2).text()); // Rendering RTE
}
}
</script>
|
The issue with the drop down list is resolved. However the Rich Text Box still has some issues:
AS you can see in the image:
The ClipMode.Ellipsis works if the text is plain text. The "R222222222..." comes from the database (plain text). The R1111111 was saved from the screen.
As you can see in the image below, now the the text has some html and that is why (I believe) the ClipMode.Ellipsis does not work:
My final goal is to be able to include an image and that works perfect! but I want to use the ClipMode to only show a few characters and not the full image (in the Grid):
Thanks in advance for all your help.
<script type="text/x-jsrender" id="columnTemplate">
<div class="e-gridellipsis" style="width:50px;overflow: hidden;">R1111111111111111</div><br />
<div style="width:50px;overflow: hidden;">
<img style="width: 75px; height: 20px" src="../content/images/grid/Employees/{{:EmployeeID}}.png" alt="{{: EmployeeID }}" />
</div>
</script>
|
It is not about the size of the text as you can see in the image below. Is there a way to make the height of the column fixed on the grid? I want o keep the images in the database. This is a sample not the real application, so the alternative of saving to a path will not work. if I can keep the row height fixed that may be a solution.
I still believe the ClipMonde is working on HTML text.
Thanks
Sorry I was trying to say:
I still believe the ClipMonde is not working on HTML text.
I did some testing with your code and I think this solution is acceptable for me: This is what I did:
On the grid:
<e-column field="Resume" header-text="Resume" text-align="Left" width="100" clip-mode="@(ClipMode.Ellipsis)" Template="#columnTemplate" ></e-column>
The Script:
<script type="text/x-jsrender" id="columnTemplate">
<div class="e-gridellipsis" style="width:150px;overflow: hidden">Click Edit to see full text</div>
</script>