我有一個問題,在我的控制器中,我將值設置爲集合並將其存儲在ViewData中。例如:mvc2,查詢和qtip問題
ViewData["ex1"] = new SelectList(ex1); // a simple collection
ViewData["ex2"] = new SelectList(group.Members, "Id", "Gender");
我將這些傳遞給我的視圖,並像這樣循環。例如:
<div id="divListBox" style="overflow:auto; border:1px solid #CCCCCC; padding-left:5px; background-color:white; height: 130px">
<%
var list = this.ViewData["e2x"] as SelectList;
var pList = this.ViewData["ex1"] as SelectList;
foreach (var p in list)
{
foreach (var pil in pList)
{
if(pil.Text.Contains(p.Value)) // ex1 does contains ex2
{
%>
<input id="cbPerson" type="checkbox" value="<%= p.Value %>" />
<label for="cbPerson"><%= p.Text %></label>
<input id="cbPersonInfo" type="hidden" value="<%= pil.Text %>" /><br />
<%
}
}
}
%>
</div> ...
這裏是我的jQuery。例如:
$('#divListBox > input').each(function() {
var personInfo = $('#cbPersonInfo').val();
$(this).append($('personInfo'));
$('*').qtip('hide');
$('#divListBox label').each(function() {
$(this).qtip({
content: personInfo,
show: 'mouseover',
hide: 'mouseout',
style: {
classes: 'ui-tooltip-custom',
tip: true
},
position: {
my: 'left bottom',
at: 'top right'
}
});
});
});
如果我設置我的輸入類型「隱藏」到「文本」,我看到每一個正確的信息。 Hoever,當我將鼠標懸停在他們身上時,第一條信息顯示爲所有人的工具提示。我認爲這可能是我的jQuery,但我不太確定。我一直在處理這個問題幾個小時,但仍然沒有。任何人都可以幫忙嗎?
感謝Nealv,但是現在的工具提示還很遙遠。有沒有辦法只是懸停在標籤上方,尖端就在它的上方。現在,我認爲,因爲所有內容都放在div內,所以工具提示會顯示div的結尾。我不想將div的寬度調整爲固定寬度,要麼是因爲某些人的職業比其他人長。 – hersh 2010-07-27 17:34:59
你可以把網頁在線嗎?我會修復nealv的css – Nealv 2010-07-27 18:03:14
,我已經知道了。我已經替換了你的...「$(this).qtip({」... with「$(this).find('label')。qtip({」...再次感謝幫助和謝謝你爲我節省了很多時間 – hersh 2010-07-27 18:58:33