Dear Infragistics Gurus,
Good morning.
In relate to my prvevious post regarding RowEditTemplates. I would just like to ask if its possible to create a custom layout with the RowEditTemplate window that opens? Can I re-layout it and add some images? I am actually thinking of adding some images related to the description information being editted by the user. Can it be done using the RowEditTemplate or another option is use the iDialog window and do some of the CRUD operations using the iDialog?
Thanks in advance Infragistic Gurus :)
hi Almond,
Please, take a look at this thread and let me know if it helps you.
http://ko.infragistics.com/community/forums/p/76453/386971.aspx
regards
Lyubo
Hello Lyubo,
Much thanks for the link. Would just like to inquire if the code will also work for MVC projects?
Thanks and good day once again.
Almond
Hello Lybo,
Much thanks agian for the reply.
I am actually a newbie in MVC and having a hard time in adjusting your code :)
Could you possibly help me with my code below:
@(Html.Infragistics().Loader()
.ScriptPath(Url.Content("~/Scripts/IG/js/"))
.CssPath(Url.Content("~/Content/IG/css/"))
.Theme("metro")
.Resources("igShared")
.Render())
<script type="text/javascript">
var updates;
var grid = $('#grid1');
$.ig.loader(function () {
$("#saveChanges").igButton({ labelText: $("#saveChanges").val(), disabled: true });
$("#undo").igButton({ labelText: $("#undo").val(), disabled: true });
$("#redo").igButton({ labelText: $("#redo").val(), disabled: true });
grid.live("iggridupdatingrowdeleted", function (e, args) {
$("#undo").igButton("option", "disabled", false);
$("#saveChanges").igButton("option", "disabled", false);
});
grid.bind("iggridupdatingeditrowended", function (e, args) {
if (args.update) {
}
$("#undo").live('igbuttonclick',function (e, args) {
updates = grid.data('igGrid').dataSource.allTransactions();
grid.igGrid("rollback", true);
$("#redo").igButton("option", "disabled", false);
$("#undo").igButton("disable");
$("#saveChanges").igButton("disable");
return false;
);
$("#redo").live('igbuttonclick',function (e) {
$.each(updates, function (index, transaction) {
switch (transaction.type) {
case "row":
$('#grid1').igGridUpdating('updateRow', transaction.rowId, transaction.row, null, false);
break;
case "newrow":
$('#grid1').igGridUpdating('addRow', transaction.row, false);
case "deleterow":
$('#grid1').igGridUpdating('deleteRow', transaction.rowId, false);
$(this).igButton("disable");
$("#saveChanges").live('igbuttonclick',function (e) {
$("#grid1").igGrid("saveChanges");
$("#grid1").live("iggridupdatingroweditdialogclosed", function (event, ui) {
if (event.buttons == 0) {
} else {
$("#undo").igButton("option", "disabled", true);
$("#saveChanges").igButton("option", "disabled", true);
$("#grid1").live("iggridupdatingdatadirty", function (event, ui) {
$("#grid1").igGrid("commit");
</script>
@{ ViewBag.Title = "List of Branches";}
@(Html.Infragistics().Grid<csis2013Mvc3.tbl_branches>()
.ID("grid1")
.PrimaryKey("branch_idno")
.AutoGenerateColumns(false)
.AutoGenerateLayouts(false)
.AutoCommit(false)
.UpdateUrl(Url.Action("EditingBranches"))
.Columns(column =>
{
column.For(x => x.branch_idno).DataType("number").Hidden(true);
column.For(x => x.branch_code).HeaderText("CODE: ").DataType("string");
column.For(x => x.branch_location).HeaderText("LOCATION: ").DataType("string");
column.For(x => x.branch_chapel_desc).HeaderText("DESCRIPTION: ").DataType("string");
column.For(x => x.branch_contactperson).HeaderText("CONTACT PERSON: ").DataType("string");
column.For(x => x.branch_contactno).HeaderText("CONTACT NO.: ").DataType("string");
})
.Features(feature =>
feature.Selection().Mode(SelectionMode.Row).MultipleSelection(false);
feature.Sorting().Type(OpType.Local);
feature.Paging().PageSize(10).PrevPageLabelText("Previous").NextPageLabelText("Next");
feature.Filtering().Type(OpType.Local);
feature.Updating().EnableAddRow(true).EnableDeleteRow(true)
.EditMode(GridEditMode.RowEditTemplate)
.RowEditDialogContainment("owner")
.RowEditDialogWidth("375px")
.RowEditDialogHeight("275px")
.RowEditDialogOkCancelButtonWidth("100px")
.RowEditDialogFieldWidth("200px")
.ShowReadonlyEditors(false);
.Virtualization(false)
.ClientDataSourceType(ClientDataSourceType.JSON)
.DataSourceUrl(Url.Action("BranchList"))
.ResponseDataKey("")
.Height("100%")
.DataBind()
<br/>
<button id="saveChanges" value="@Resources.SAVE_CHANGES"></button>
<button id="undo" value="@Resources.UNDO"></button>
<button id="redo" value="@Resources.REDO"></button>
Thanks in advance for the help and good day once again.
almond :)
Hello Almond,
In order to customize the edit template you can just access the dialog element in the rowEditDialogContentsRendered event. Once you have the dialog element you can append the image that you want to it.
For example this line will append an image just below the editable fields:
in js:
//Bind after initialization
$(document).delegate("#grid1", "iggridupdatingroweditdialogcontentsrendered", function (evt, ui) {
ui.dialogElement.children('.ui-dialog-content').append('<img src="http://localhost:39783/Images/tick.png" />');
if you want to access the titlebar you could try:
ui.dialogElement.children('.ui-dialog-titlebar')
with this lime you could access the buttons:
ui.dialogElement.children('.ui-dialog-buttonpane')
More about the customizing of the dialog you could find in our documentation:
http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/igGrid_Updating_RowEditTemplate_Configuring.html
Please let me know if this helps.
Dear Elena,
Much thanks for your reply. We'll try and check if i can successfully implement your suggestion.
I also have one more question, can the image below be implemented using the rowedittemplate features?
Thanks in advance and hope you can help me with regarding the customizing the rowedittemplate :)
regards,
almond
Hello Infragistics Gurus.
Can anyone help me with my inquiry above?
Thanks in advance :)
Hello Almond ,
If you handle the RowEditDialogContentsREndered event you can customize this dialog the way you want:
//return the triggered event
evt;
// get reference to igGridUpdating widget
ui.owner;
// get reference to the row edit dialog DOM element
ui.dialogElement;
// get reference to the row edit dialog titlebar
ui.dialogElement.children('.ui-dialog-titlebar');
// get reference to the row edit dialog content element
ui.dialogElement.children('.ui-dialog-content').css("marginLeft", "-100");
As you can see from the snippet that I have provided, in this element you can get all of the elements in this dialog. Then you can use jQuery append and prepend functions in order to add some additional elements and style them in order to suit your design:
http://api.jquery.com/append/
http://api.jquery.com/prepend/
Please notice that even when you make changes to the dom of the dialog you should keep the tr tags where we place the input elements for our editors. This way no mater of the customizations that you make to the design our igGrid will be able to map the data that you enter to the current row.
For additional reference you could use the following link from our documentation which discusses the properties that we have exposed related to the edit dialog:
http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/igGrid_Updating_RowEditTemplate.html
Please let me know if you need any additional information on this matter.
Hello Infragistic Gurus,
Would like to follow up on my below inquiry. Can anyone provide me a working example?
Thanks in advance and good day to everyone.
More power to Infragistics while less coding to developers :D
regards,almond
Much thanks for the help Elena. I am still having a hard time with regards to my problem. Would it be too much if I could request for a working sample with the layout including the image.