From 4bdfdb0a8e54d7040a266aac85fb6cf8546d312a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C4=99czek?= Date: Fri, 25 Mar 2011 17:47:34 +0100 Subject: [PATCH] Lib.Web.Mvc - Bug Fixes --- .../JqGrid/DataAnnotations/JqGridColumnEditableAttribute.cs | 1 + Lib.Web.Mvc/JQuery/JqGrid/JqGridColumnModel.cs | 6 ++++-- Lib.Web.Mvc/JQuery/JqGrid/JqGridHelper.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib.Web.Mvc/JQuery/JqGrid/DataAnnotations/JqGridColumnEditableAttribute.cs b/Lib.Web.Mvc/JQuery/JqGrid/DataAnnotations/JqGridColumnEditableAttribute.cs index 787c53d..c3454c5 100644 --- a/Lib.Web.Mvc/JQuery/JqGrid/DataAnnotations/JqGridColumnEditableAttribute.cs +++ b/Lib.Web.Mvc/JQuery/JqGrid/DataAnnotations/JqGridColumnEditableAttribute.cs @@ -208,6 +208,7 @@ public JqGridColumnEditableAttribute(bool editable) EditOptions = new JqGridColumnEditOptions(); EditRules = new JqGridColumnEditRules(); EditType = JqGridColumnEditTypes.Text; + FormOptions = new JqGridColumnFormOptions(); } /// diff --git a/Lib.Web.Mvc/JQuery/JqGrid/JqGridColumnModel.cs b/Lib.Web.Mvc/JQuery/JqGrid/JqGridColumnModel.cs index 8a0a0f7..5f5698e 100644 --- a/Lib.Web.Mvc/JQuery/JqGrid/JqGridColumnModel.cs +++ b/Lib.Web.Mvc/JQuery/JqGrid/JqGridColumnModel.cs @@ -165,8 +165,6 @@ internal JqGridColumnModel(ModelMetadata propertyMetadata) Sortable = columnSortableAttribute.Sortable; Index = columnSortableAttribute.Index; } - else - Index = propertyMetadata.PropertyName; JqGridColumnSearchableAttribute columnSearchableAttribute = customAttributes.OfType().FirstOrDefault(); if (columnSearchableAttribute != null) @@ -191,6 +189,7 @@ internal JqGridColumnModel(ModelMetadata propertyMetadata) EditOptions = columnEditableAttribute.EditOptions; EditRules = columnEditableAttribute.EditRules; EditType = columnEditableAttribute.EditType; + FormOptions = columnEditableAttribute.FormOptions; if ((propertyMetadata.ModelType == typeof(Int16)) || (propertyMetadata.ModelType == typeof(Int32)) || (propertyMetadata.ModelType == typeof(Int64)) || (propertyMetadata.ModelType == typeof(UInt16)) || (propertyMetadata.ModelType == typeof(UInt32)) || (propertyMetadata.ModelType == typeof(UInt32))) EditRules.Integer = true; @@ -219,6 +218,9 @@ internal JqGridColumnModel(ModelMetadata propertyMetadata) Name = propertyMetadata.PropertyName; + if (String.IsNullOrWhiteSpace(Index)) + Index = propertyMetadata.PropertyName; + if (!String.IsNullOrWhiteSpace(propertyMetadata.TemplateHint) && propertyMetadata.TemplateHint.Equals("HiddenInput")) Hidden = true; else diff --git a/Lib.Web.Mvc/JQuery/JqGrid/JqGridHelper.cs b/Lib.Web.Mvc/JQuery/JqGrid/JqGridHelper.cs index be1b8e8..b4b32c7 100644 --- a/Lib.Web.Mvc/JQuery/JqGrid/JqGridHelper.cs +++ b/Lib.Web.Mvc/JQuery/JqGrid/JqGridHelper.cs @@ -676,7 +676,7 @@ private static void AppendNavigatorActionOptions(JqGridNavigatorActionOptions ac javaScriptBuilder.AppendFormat("modal: {0},", actionOptions.Modal.Value.ToString().ToLower()); if (actionOptions.MethodType.HasValue) - javaScriptBuilder.AppendFormat("mtype: {0},", actionOptions.MethodType.Value.ToString().ToUpper()); + javaScriptBuilder.AppendFormat("mtype: '{0}',", actionOptions.MethodType.Value.ToString().ToUpper()); if (!String.IsNullOrWhiteSpace(actionOptions.OnClose)) javaScriptBuilder.AppendFormat("onClose: '{0}',", actionOptions.OnClose);