Hi,
I am setting this in C# in an MVC3 View.
The grid however refuses to accept it. no error but the grid always starts editing after 1 click.
Regards
Graham
@(Html.Infragistics().Grid<CRUD1.Models.Site>()
.ID("SiteGrid")
.AutoGenerateColumns(false)
.PrimaryKey("Id")
.Columns(column =>
{
column.For(x => x.Id).DataType("number").HeaderText("Id");
column.For(x => x.SBII_SiteId).DataType("number").HeaderText("Site Id");
column.For(x => x.SiteName).DataType("string").HeaderText("Site Name");
column.For(x => x.Client_SiteId).DataType("string").HeaderText("Client Site Id");
column.For(x => x.Address1).DataType("string").HeaderText("Address 1");
column.For(x => x.Address2).DataType("string").HeaderText("Address 2");
column.For(x => x.Address3).DataType("string").HeaderText("Address 3");
column.For(x => x.PostCode).DataType("string").HeaderText("PostCode");
column.For(x => x.Phone).DataType("string").HeaderText("Phone");
column.For(x => x.EARegistration).DataType("string").HeaderText("EAReg");
column.For(x => x.IpAddress).DataType("string").HeaderText("Site Ip");
column.For(x => x.SBII_IpAddress).DataType("string").HeaderText("Controller Ip");
column.For(x => x.Enabled).DataType("bool").HeaderText("Enabled");
})
.Features(feature =>
feature.Updating().EditMode(GridEditMode.Row).StartEditTriggers(GridStartEditTriggers.DblClick);
feature.Updating().ColumnSettings(settings =>
settings.ColumnSetting().ColumnKey("Id").ReadOnly(true);
settings.ColumnSetting().ColumnKey("SiteId").EditorType(ColumnEditorType.Numeric).Required(true).Validation(false);
settings.ColumnSetting().ColumnKey("SiteName").EditorType(ColumnEditorType.Text).Required(true).Validation(true);
settings.ColumnSetting().ColumnKey("Address1").EditorType(ColumnEditorType.Text).Required(false).Validation(true);
settings.ColumnSetting().ColumnKey("Address2").EditorType(ColumnEditorType.Text).Required(false).Validation(true);
settings.ColumnSetting().ColumnKey("Address3").EditorType(ColumnEditorType.Text).Required(false).Validation(true);
settings.ColumnSetting().ColumnKey("PostCode").EditorType(ColumnEditorType.Text).Required(false).Validation(true);
settings.ColumnSetting().ColumnKey("Phone").EditorType(ColumnEditorType.Text).Required(false).Validation(true);
settings.ColumnSetting().ColumnKey("EARegistration").EditorType(ColumnEditorType.Text).Required(false).Validation(true);
settings.ColumnSetting().ColumnKey("Client_SiteId").EditorType(ColumnEditorType.Text).Required(false).Validation(false);
settings.ColumnSetting().ColumnKey("IpAddress").EditorType(ColumnEditorType.Text).Required(false).Validation(false);
settings.ColumnSetting().ColumnKey("SBII_IpAddress").EditorType(ColumnEditorType.Text).Required(false).Validation(false);
settings.ColumnSetting().ColumnKey("Enabled").ReadOnly(true);
});
.DataSourceUrl(Url.Action("Details", "Site"))
.UpdateUrl(Url.Action("Update", "Site"))
//MUST remember to do these !!
.DataBind()
.Render()
)
Hi Graham,
I tested features.Updating().StartEditTriggers(GridStartEditTriggers.DblClick)... and it worked correctly. I also tested online sample (please try to test it too)http://samples.infragistics.com/jquery/grid/row-editing-api'
which has setter for DblClick and that also worked as expected.That is possible that in your application those settings for some reason do not have effect or they are overriden by some other logic.
Please run your sample, open source of generated html (in browser) and try to find string "startEditTriggers:". That should be located somewhere within igGrid({ ....... }); block and it should appear asstartEditTriggers: 'DblClick'
Found the problem !!
I later tried to add EnableAddRow(false), and that too failed !!.
The PROBLEM is that the grid allows me to use the code as follows in my cshtml file :
feature.Updating().EnableAddRow(false); feature.Updating(). EditMode(GridEditMode.Row).StartEditTriggers(GridStartEditTriggers.DblClick); feature.ColumnSettings(settings => { etc. etc.
feature.Updating().EnableAddRow(false);
feature.Updating().
EditMode(GridEditMode.Row).StartEditTriggers(GridStartEditTriggers.DblClick);
feature.ColumnSettings(settings =>
{ etc. etc.
It then proceeds to generate js with multiple entries for 'Updating' - BUT it only seems to actually accept the last one :-O.
If I combine ALL of the above into a single feature setting - it works and accepts ALL relevant settings.
This has to be a bug in the grid - as it accepts the multiple { Updating xxx } code but refuses to accept them.
Hope this helps you fix this issue ;-)).
I am glad that you found the problem.If application uses multiple statements like you showed, then that can be considered as an error in application. Though similar also can be intentional, like debugging by temporary codes without removing old logic. The order to process same setter with different values is defined by Mvc framework, and I expect that the last statement has priority and should win. The nature/signature of setter methods allows multiple calls to same methods and each method sets whole object, but not only its specific nested members. I do not see anything wrong with that and applicatoin should keep in mind that rule.
Victor,
Again - thanks for the feedback. I would take issue with your comments however ;-).
1. Application error - if so, then your MVC framework API should reject such calls.
2. The issue is not in the MVC API - as the multiple statements get sent out as script to the browser.
My view is that if there is a design time API - then thats where the logic should exist to check for such 'errors' (although i don't consider it to be an error to program in this way - as many other API's 9I believe) allow this type of programming, as indeed does yours ;-). Again - the error is in the browser where the multiple calls are ignored :-O.
Best Regards