Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142296 | Jan 25,2019 05:31 PM UTC | Jan 29,2019 12:37 PM UTC | ASP.NET Core - EJ 2 | 1 |
![]() |
Tags: DataGrid |
...
<ejs-grid id="Grid" actionBegin="actionBegin" toolbar="@(new List<string>() { "Add", "Update", "Cancel" })" created="created">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true">
</e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="orderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="120"></e-grid-column>
<e-grid-column field="customerID" width="140"></e-grid-column>
<e-grid-column field="shipCity" headerText="ship City" template="#columnTemplate" edit="@(new {create = "create", read = "read", write = "write"})" width="200">
</e-grid-column>
</e-grid-columns>
</ejs-grid>
<script type="text/x-template" id="columnTemplate">
<img src='/images1000.png' />
</script>
<script type="text/javascript">
var dataSource = @Html.Raw(Json.Serialize(ViewBag.datasource));
function created(args) {
this.dataSource = new ej.data.DataManager({
json: dataSource,
insertUrl: 'Home/NormalInsert',
adaptor: new ej.data.RemoteSaveAdaptor()
});
}
var elem;
var dobj;
function create() {
elem = document.createElement('div');
return elem;
}
function write(args) {
$(elem).ejSignature({ width: "200px", height: "35px", backgroundcolor: "yellow" });
}
function read(args) {
return $(elem).ejSignature({});
}
function actionBegin(args) {
if (args.requestType == "save" || args.requestType == "cancel") {
var canvas = $("#Grid").find("canvas")[0];
image = canvas.toDataURL("image/png");
var imgData = image.replace('data:image/png;base64,', '');
args.data.shipCity = imgData;
}
}
... |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.