Page 1 of 1
Add a custom field in edit Page
Posted: Tue Jun 07, 2016 8:57 pm
by Thomas.Hoffner
Hello
We added a column in the List Page in Event "ListOptions_Load" like that:
var opt = ListOptions.Add("kg_Value");
opt.Header = "Menge [kg]";
opt.OnLeft = false; // Link on left
opt.MoveTo(0); // Move to first column
Is it possible to add a custom field in Edit page in Event: Page_Load somthing like that:
cField myfield =new cField(........
myfield.FldName = "Hase";
myfield.Visible = true;
myfield.FldDbType = ewDbType.Float;
myfield.CurrentValue = "888";
Fields.Add("Thomas", myfield);
????
I do not need the custom field in database.
Re: Add a custom field in edit Page
Posted: Wed Jun 08, 2016 9:54 am
by motfs
I would suggest to use Startup Script (Client Scripts -> Table-Specific -> Edit Page -> Startup Script) to create the field, e.g.:
$("<selector>").append("<HTML code>");
Re: Add a custom field in edit Page
Posted: Thu Jun 09, 2016 5:19 pm
by Thomas.Hoffner
Hello
Thanks for yout help !
I hve got the solition to add a value field (column) in the Edit-View. This Column ist not in the database table.
In the following example I add a field after the field "BES"
This JavaScript code I added in "ClientScripts/Table-Speciic/EditPage/StartupScript".
var html_text = "<tr id='r_BES_kg' @(Html.Raw(view_Tank.RowAttributes))>";
html_text = html_text + "<td class='ewTableHeader'><span id='elh_view_Tank_BES_kg'><table class='ewTableHeaderBtn'><tr><td>@Html.Raw(view_Tank.BES.FldCaption)</td></tr></table></span></td>";
html_text = html_text + "<td @(Html.Raw(view_Tank.SPEZ_GEW.CellAttributes))><span id=#el_view_Tank_BES_kg'>";
html_text = html_text + "<text>";
html_text = html_text + "<input type='text' name='x_BES_kg' id='x_BES_kg' size='30' value='@view_Tank.BES.EditValue' onchange='AWR_java_change_BES_kg(this.value);'/>";
html_text = html_text + "</text>";
html_text = html_text + "</span>@Html.Raw(view_Tank.SPEZ_GEW.CustomMsg)</td>";
html_text = html_text + "</tr>";
$("#r_BES").after(html_text);
I hope it is useful for other users.
Thomas Hoffner