From c9cb54a937b0d68addb723015e592fba302d7a45 Mon Sep 17 00:00:00 2001 From: alexY Date: Thu, 30 Apr 2015 12:52:52 +0300 Subject: [PATCH 1/4] Autocomplete result set constrained to 15 items --- .../DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs index fe3592d0..d51cd056 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs @@ -23,7 +23,7 @@ namespace WebsitePanel.WebPortal int itemType = Int32.Parse(strItemType); DataSet dsObjectItems = ES.Services.Packages.SearchServiceItemsPaged(PanelSecurity.EffectiveUserId, itemType, String.Format("%{0}%", filterValue), - "",0, 100); + "",0, 15); DataTable dt = dsObjectItems.Tables[1]; List> dataList = new List>(); for (int i = 0; i < dt.Rows.Count; ++i) @@ -47,7 +47,7 @@ namespace WebsitePanel.WebPortal { DataSet dsObjectItems = ES.Services.Packages.GetSearchObject(PanelSecurity.EffectiveUserId, null, String.Format("%{0}%", filterValue), - 0, 0, "", 0, 100, columnType,fullType); + 0, 0, "", 0, 15, columnType,fullType); DataTable dt = dsObjectItems.Tables[2]; List> dataList = new List>(); for (int i = 0; i < dt.Rows.Count; ++i) From f77585c45eda808470996f72e36abe58ad66c0cb Mon Sep 17 00:00:00 2001 From: alexY Date: Thu, 30 Apr 2015 12:57:28 +0300 Subject: [PATCH 2/4] itemCount parameter is added to autocomplete handler --- .../WebsitePanel/Code/Helpers/AjaxHandler.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs index d51cd056..a42791e0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs @@ -16,6 +16,14 @@ namespace WebsitePanel.WebPortal String filterValue = context.Request.Params["term"]; String fullType = context.Request.Params["fullType"]; String columnType = context.Request.Params["columnType"]; + String numResults = context.Request.Params["itemCount"]; + int iNumResults = 15; + if ((numResults != null) && (numResults.Length > 0)) + { + int num = Int32.Parse(numResults); + if (num > 0) + iNumResults = num; + } if (fullType == "Spaces") { @@ -23,7 +31,7 @@ namespace WebsitePanel.WebPortal int itemType = Int32.Parse(strItemType); DataSet dsObjectItems = ES.Services.Packages.SearchServiceItemsPaged(PanelSecurity.EffectiveUserId, itemType, String.Format("%{0}%", filterValue), - "",0, 15); + "", 0, iNumResults); DataTable dt = dsObjectItems.Tables[1]; List> dataList = new List>(); for (int i = 0; i < dt.Rows.Count; ++i) @@ -47,7 +55,7 @@ namespace WebsitePanel.WebPortal { DataSet dsObjectItems = ES.Services.Packages.GetSearchObject(PanelSecurity.EffectiveUserId, null, String.Format("%{0}%", filterValue), - 0, 0, "", 0, 15, columnType,fullType); + 0, 0, "", 0, iNumResults, columnType, fullType); DataTable dt = dsObjectItems.Tables[2]; List> dataList = new List>(); for (int i = 0; i < dt.Rows.Count; ++i) From ea01a472089ea08b93efad2492ef951462bf56a3 Mon Sep 17 00:00:00 2001 From: alexY Date: Thu, 30 Apr 2015 15:53:29 +0300 Subject: [PATCH 3/4] Full type name fix --- WebsitePanel/Database/update_db.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index f3d7e30a..d646dd41 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -10848,7 +10848,7 @@ SET @sqlSpace = ' SI.ItemID as ItemID, SI.ItemName as TextSearch, STYPE.DisplayName as ColumnType, - SI.ItemName as FullType, + STYPE.DisplayName as FullType, SI.PackageID as PackageID FROM @ItemsService AS I INNER JOIN ServiceItems AS SI ON I.ItemID = SI.ItemID From 589fcbff09f961999103aca5a9415b37f4896322 Mon Sep 17 00:00:00 2001 From: alexY Date: Thu, 30 Apr 2015 16:40:55 +0300 Subject: [PATCH 4/4] rowCount bug fix for autocomplete --- .../WebsitePanel/Code/Helpers/AjaxHandler.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs index a42791e0..5116835c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/AjaxHandler.cs @@ -61,16 +61,13 @@ namespace WebsitePanel.WebPortal for (int i = 0; i < dt.Rows.Count; ++i) { DataRow row = dt.Rows[i]; - if ((fullType == null) || (fullType.Length == 0) || (fullType == row["FullType"].ToString())) - { - Dictionary obj = new Dictionary(); - obj["ColumnType"] = row["ColumnType"].ToString(); - obj["TextSearch"] = row["TextSearch"].ToString(); - obj["ItemID"] = row["ItemID"].ToString(); - obj["PackageID"] = row["PackageID"].ToString(); - obj["FullType"] = row["FullType"].ToString(); - dataList.Add(obj); - } + Dictionary obj = new Dictionary(); + obj["ColumnType"] = row["ColumnType"].ToString(); + obj["TextSearch"] = row["TextSearch"].ToString(); + obj["ItemID"] = row["ItemID"].ToString(); + obj["PackageID"] = row["PackageID"].ToString(); + obj["FullType"] = row["FullType"].ToString(); + dataList.Add(obj); } var jsonSerialiser = new JavaScriptSerializer();