我想在表單中使用jQuery multiselect插件編輯jqGrid(添加表單)。asp.net jqGrid下拉多選擇
這是我使用建下拉代碼(colModel
摘錄):
{
name: 'CaratteristicheCamera',
index: 'CaratteristicheCamera',
width: 50,
hidden: true,
edittype: 'select',
editable: true,
editrules: { edithidden: true, required: true },
editoptions: {
multiselect: true,
dataUrl: '<%# ResolveUrl("~/Service/Domain/ServiceRoom.asmx/GetRoomFeatureList") %>',
buildSelect: function (data) {
var retValue = $.parseJSON(data);
var response = $.parseJSON(retValue.d);
var s = '<select id="CaratteristicheCamera" name="CaratteristicheCamera">';
if (response && response.length) {
for (var i = 0, l = response.length; i < l; i++) {
s += '<option value="' + response[i]["Id"] + '">' +
response[i]["Descrizione"] + '</option>';
}
}
return s + "</select>";
},
dataInit: function() {
$("#CaratteristicheCamera").multiselect();
}
}
},
正如你們所看到的,jqGrid的調用的WebMethod放在ASMX文件。一切似乎工作正常,但我無法收到用戶從下拉列表中選擇的所有值。看來系統發送給服務器最後一個選擇。 你有任何提示嗎?
編輯:這是ASMX web服務聲明
[WebMethod]
public string SaveRoom(string id, string codice, string Numero, string NumeroPiano,
string Nome, string TipoCamera, string StatoCamera,
string CaratteristicheCamera, string TipoSdoppiabilita)
{}
你能否指定更確切的來自你嘗試使用的「multiselect」插件。是Eric Hynds [jQuery UI MultiSelect Widget](https://github.com/ehynds/jquery-ui-multiselect-widget)?你能描述一下更爲詳細的現存問題嗎?您寫下了「我無法接收用戶從下拉列表中選擇的所有值」。用戶選擇列表是否被剪切?你另外寫了另外一個問題:「系統發送給服務器最後一個選擇」。你的意思是**以前的**選擇?因此,如果您第二次打開表單,用戶的第一個選擇將被髮送到服務器? – Oleg 2012-04-03 10:54:44
是的,我使用Eric Hynds圖書館(v 1.12)。會發生什麼是我點擊加號圖標來添加新的實體;它會出現在窗體中,我可以填充它的所有字段,並且可以在CaratteristicheCamera下拉列表中選擇多個項目。然後,我點擊保存按鈕,系統調用asmx webmethod,但在參數中我看到,通過調試,只是最後選擇的項目。 (我編輯我的問題) – frabiacca 2012-04-03 11:05:14