fix autocomplete + fix selezione collaudi (data machcina cambio fase..)

This commit is contained in:
Samuele E. Locatelli
2018-03-26 17:09:15 +02:00
parent 3679a2c82f
commit 9c74b7eff6
16 changed files with 1367 additions and 733 deletions
@@ -5,110 +5,107 @@
<webopt:BundleReference ID="BundleReference2" runat="server" Path="~/Content/themes/base/css" />
<%} %>
<style>
.ui-autocomplete {
max-height: 36em;
min-width: 20em;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
}
/* IE 6 doesn't support max-height
.ui-autocomplete {
max-height: 36em;
min-width: 20em;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 36em;
}
* html .ui-autocomplete {
height: 36em;
}
</style>
<script>
// funzione autocomplete
function set<%=txtSel.ClientID %>()
{
//$("input").autocomplete({
$("#<%=txtSel.ClientID %>").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "<%=txtServiceUrl.Text %>",
data: "{'prefixText':'" + request.term + "'}",
dataType: "json",
async: true,
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('#')[0],
val: item.split('#')[1]
}
}))
},
error: function (result) {
alert("Impossibile caricare i dati!");
}
});
},
select: function (e, i) {
$("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
$("#<%=txtSel.ClientID %>").val(i.item.label);
document.getElementById('<%=btnSearch.ClientID%>').click();
},
minLength: <%=txtMinCharAutoCom.Text %>
// funzione autocomplete
function set<%=txtSel.ClientID %>() {
//$("input").autocomplete({
$("#<%=txtSel.ClientID %>").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "<%=txtServiceUrl.Text %>",
data: "{'prefixText':'" + request.term + "'}",
dataType: "json",
async: true,
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('#')[0],
val: item.split('#')[1]
}
}))
},
error: function (result) {
alert("Impossibile caricare i dati!");
}
});
}
// funzione x intercettare focusout...
function fcsOut<%=txtSel.ClientID %>()
{
$("#<%=txtSel.ClientID %>").focusout(function() {
// controllo se hidden diverso da txtsel...
var str =$("#<%=txtSel.ClientID %>").val()
if(str.search($("#<%=hiddenFieldID.ClientID %>").val())<0)
{
$("#<%=hiddenFieldID.ClientID %>").val($("#<%=txtSel.ClientID %>").val());
}
// chiamo search...
document.getElementById('<%=btnSearch.ClientID%>').click();
});
}
// aggancio evento doc pronto con jQuery...
},
select: function (e, i) {
$("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
$("#<%=txtSel.ClientID %>").val(i.item.label);
document.getElementById('<%=btnSearch.ClientID%>').click();
},
minLength: <%=txtMinCharAutoCom.Text %>
});
}
// funzione x intercettare focusout...
function fcsOut<%=txtSel.ClientID %>() {
$("#<%=txtSel.ClientID %>").focusout(function () {
// controllo se hidden diverso da txtsel...
var str = $("#<%=txtSel.ClientID %>").val()
if (str.search($("#<%=hiddenFieldID.ClientID %>").val()) < 0) {
$("#<%=hiddenFieldID.ClientID %>").val($("#<%=txtSel.ClientID %>").val());
}
// chiamo search...
document.getElementById('<%=btnSearch.ClientID%>').click();
});
}
// aggancio evento doc pronto con jQuery...
$(function () {
set<%=txtSel.ClientID %>();
fcsOut<%=txtSel.ClientID %>();
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
$(function () {
// chiamate jquery da rieseguire post ajax update x partial page render
$(function () {
set<%=txtSel.ClientID %>();
fcsOut<%=txtSel.ClientID %>();
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
$(function () {
// chiamate jquery da rieseguire post ajax update x partial page render
$(function () {
set<%=txtSel.ClientID %>();
fcsOut<%=txtSel.ClientID %>();
});
});
fcsOut<%=txtSel.ClientID %>();
});
});
});
</script>
<%--controlli "principali"--%>
<asp:Panel runat="server" ID="pnlAC">
<div class="input-group input-group-sm">
<span class="input-group-btn" style="text-align: left;">
<asp:LinkButton runat="server" ID="btnSearch" CssClass="btn btn-primary btn-sm" OnClick="btnSearch_Click">
<i class="fa fa-search text-info"></i>&nbsp;
<div class="input-group input-group-sm">
<span class="input-group-btn" style="text-align: left;">
<asp:LinkButton runat="server" ID="btnSearch" CssClass="btn btn-primary btn-sm" OnClick="btnSearch_Click">
<i class="fa fa-search text-info"></i>&nbsp;
<asp:Label runat="server" ID="lblField" />
</asp:LinkButton>
</span>
<%--searchinput form-control artworkcopylookup--%>
<asp:TextBox runat="server" ID="txtSel" CssClass="searchinput form-control" OnTextChanged="txtSel_TextChanged" AutoPostBack="True" TextMode="SingleLine" AutoCompleteType="Search" />
<%--controlli "accessori"--%>
<asp:TextBox runat="server" ID="txtMinCharAutoCom" Text="2" Visible="false" Width="1em" />
<asp:TextBox runat="server" ID="txtServiceUrl" Text="Services/WS_data.asmx/Test" Visible="false" Width="1em" />
<span class="input-group-btn">
<asp:LinkButton runat="server" ID="lnkReset" class="btn btn-primary btn-sm" OnClick="lnkReset_Click"><i class="fa fa-undo"></i></asp:LinkButton>
</span>
</div>
<asp:TextBox runat="server" ID="hiddenFieldID" AutoPostBack="true" OnTextChanged="hiddenFieldID_TextChanged" ViewStateMode="Enabled" Width="0px" Font-Size="6pt" BackColor="Transparent" BorderStyle="None" Height="0px" />
</asp:LinkButton>
</span>
<%--searchinput form-control artworkcopylookup--%>
<asp:TextBox runat="server" ID="txtSel" CssClass="searchinput form-control" OnTextChanged="txtSel_TextChanged" AutoPostBack="True" TextMode="SingleLine" AutoCompleteType="Search" />
<%--controlli "accessori"--%>
<asp:TextBox runat="server" ID="txtMinCharAutoCom" Text="2" Visible="false" Width="1em" />
<asp:TextBox runat="server" ID="txtServiceUrl" Text="Services/WS_data.asmx/Test" Visible="false" Width="1em" />
<span class="input-group-btn">
<asp:LinkButton runat="server" ID="lnkReset" class="btn btn-primary btn-sm" OnClick="lnkReset_Click"><i class="fa fa-undo"></i></asp:LinkButton>
</span>
</div>
<asp:TextBox runat="server" ID="hiddenFieldID" AutoPostBack="true" OnTextChanged="hiddenFieldID_TextChanged" ViewStateMode="Enabled" Width="0px" Font-Size="6pt" BackColor="Transparent" BorderStyle="None" Height="0px" />
</asp:Panel>
<style>
.ui-autocomplete-category {
font-weight: bold;
padding: .2em .4em;
margin: .8em 0 .2em;
line-height: 1.5;
}
.ui-autocomplete-category {
font-weight: bold;
padding: .2em .4em;
margin: .8em 0 .2em;
line-height: 1.5;
}
</style>
+38 -39
View File
@@ -1,105 +1,104 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace CMS_SC.WebUserControls
{
namespace CMS_SC.WebUserControls {
public partial class mod_autocompleteShort {
/// <summary>
/// BundleReference1 control.
/// Controllo BundleReference1.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::Microsoft.AspNet.Web.Optimization.WebForms.BundleReference BundleReference1;
/// <summary>
/// BundleReference2 control.
/// Controllo BundleReference2.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::Microsoft.AspNet.Web.Optimization.WebForms.BundleReference BundleReference2;
/// <summary>
/// pnlAC control.
/// Controllo pnlAC.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pnlAC;
/// <summary>
/// btnSearch control.
/// Controllo btnSearch.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton btnSearch;
/// <summary>
/// lblField control.
/// Controllo lblField.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblField;
/// <summary>
/// txtSel control.
/// Controllo txtSel.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtSel;
/// <summary>
/// txtMinCharAutoCom control.
/// Controllo txtMinCharAutoCom.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtMinCharAutoCom;
/// <summary>
/// txtServiceUrl control.
/// Controllo txtServiceUrl.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtServiceUrl;
/// <summary>
/// lnkReset control.
/// Controllo lnkReset.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkReset;
/// <summary>
/// hiddenFieldID control.
/// Controllo hiddenFieldID.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox hiddenFieldID;
}