jsGears.com 技術論壇 - AJAX, JavaScript, jQuery, 網站開發, 前端效能優化's Archiver

terry.lin 發表於 2009-2-5 14:35

回復 19# 的帖子

不好意思,我又遇到問題了,
我在weblogic server 8.1 上,是不能work的,
但是在其他的Ap server 上又可以正常運作,
不知道有沒有方式可以解決這個問題?

wmh 發表於 2009-2-5 19:56

你那一頁基本上都是純 client 端的程式,與 server 完全無關喔。

會不會是少了某個檔案造成的?

terry.lin 發表於 2009-2-5 22:32

回復 22# 的帖子

dear whm,
我找到問題了,
在weblogic 8.1上好像是不支援EL表達式,把那個拿掉就可以了,
再次感謝您!謝謝。

wmh 發表於 2009-2-5 22:37

:) 我是 wmh

terry.lin 發表於 2009-2-9 18:13

[quote]原帖由 [i]wmh[/i] 於 2009-2-5 22:37 發表 [url=http://jsgears.com/redirect.php?goto=findpost&pid=303&ptid=114][img]http://jsgears.com/images/common/back.gif[/img][/url]
:) 我是 wmh [/quote]
sorry, wmh,
我又遇到一個小問題,試了好久,還是沒有成功,可以點我一下嗎?
function formatItem是正常的,可以出現row[0]+" "+row[1]+" "+row[2]的資料,
但是function formatResult卻還是一樣只出現row[0]的資料而已,麻煩幫我看一下,謝謝。
我的每一個資料格式如下:
品名 | 產地 | 價錢

                            var contextRoot= "http://localhost:7001/Stamper";
                        
                        $(function(){   
                        $("#t1").autocomplete(contextRoot+'/GoodServlet',
                        {
                        delay:100,
                        width:200,
                        minChars:3,
                        autoFill:false,
                        maxItemsToShow:10,
                        formatItem: function(row, i, max) {
                        return row[0]+" "+row[1]+" "+row[2] ;
                        },
                        formatResult: function(row){
                        return row[0]+" "+row[1] ;
                        }
                        })   
                        });

wmh 發表於 2009-2-9 22:12

我測試結果是沒問題的耶,我直接用你的那一組設定,formatResult() 是可以正常運作的。

terry.lin 發表於 2009-2-9 23:24

回復 26# 的帖子

謝謝回復,那我再找看看是什麼問題好了,感謝!

terry.lin 發表於 2009-2-12 14:29

回復 26# 的帖子

原來是js版本的問題,害我弄了好久~~:L
能否再請較一下,當我輸入了一個字後,從autocomplete所回傳的清單中點選一個值,然後我要去做某件事,這是要用什麼function啊?

wmh 發表於 2009-2-12 21:48

我看官方網站的範例中,可以針對原本那個輸入框加上 result() 事件的處理:

[code js]
  $("#t1").result(function(event, data, formatted) {
    //這邊是你要處理的事情, ex:
    alert('你選擇了' + $(this).val());
  });
[/code]

terry.lin 發表於 2009-2-13 12:16

回復 29# 的帖子

Dear wmh,
真是感謝您,open source就是要有你這種人才會愈來愈進步,謝謝。:lol

wmh 發表於 2009-2-13 12:27

Dear terry,
您真是太誇張了啦 :lol

open source就是要有你這種人熱心參與才會愈來愈進步,謝謝

liaoost 發表於 2009-2-20 10:37

wmh~
請問如果我要實作 Server Control 元件 +jQuery 來完成 Autocomplete.
不透過Ajax,只用 ICallbackEventHandler 來完成.
要如何下手呢?

以上 謝謝

wmh 發表於 2009-2-20 11:59

ICallbackEventHandler 應該是要配合特定控制項,這樣就不適合再用 jQuery 的 AutoComplete Plugin 了

如果用 jQuery 的 AutoComplete Plugin 的話,Server 端只需要做查詢、輸出,很單純的。

liaoost 發表於 2009-2-20 14:48

目前我的Sever 端可以回傳資料到 Client 端. 回傳格式:["台北市","台北市士林區","台北市大同區","台北市大安區"]
而我用下面的 javascript 去接收回傳資料.
$("#TBTextBoxAutoComplete1").autocomplete(data); 必須將滑鼠點到其它地方後在點回輸入框值才會出現.(好像要讓它失焦).

<script type="text/javascript">  
  function ReceiveServerData(rValue) {
    var data = eval ("(" + rValue + ")");   
    $("#TBTextBoxAutoComplete1").autocomplete(data);
  };
</script>

wmh 發表於 2009-2-20 23:19

我猜你可能用錯了方法

[code js:nocontrols]$("#TBTextBoxAutoComplete1").autocomplete(data);[/code]

這一段是一個初始化的動作,只需要做一次,TBTextBoxAutoComplete1 這個輸入框就可以有了 autocomplete 的功能。

而你寫在 ReceiveServerData() 內,應該是某個動作執行完成後就會觸發,這時是做 autocomplete 的初始化,而非 autocomplete 的篩選動作,所以沒有達到你想要的功能。

liaoost 發表於 2009-2-23 14:08

您好:[code]$("#TBTextBoxAutoComplete1").autocomplete(data);  [/code]初始化的動作,只要做一次,那它觸發是由原先jQuery已幫它寫好.
那是否表示,變數data一開始也被寫入了呢?
那請問有辨法動態更改Client 端原先data變數內的值嗎?
以上 謝謝.

[[i] 本帖最後由 liaoost 於 2009-2-23 15:41 編輯 [/i]]

wmh 發表於 2009-2-23 21:13

你需要的應該是透過 Server 端更新資料:

[code js]
$("#TBTextBoxAutoComplete1").autocomplete('somwhere.aspx');
[/code]

改成這樣寫,client 端 user 輸入了一些字串後,會用 q 這個變數傳到 somewhere.aspx,
somewhere.aspx 需要做的就是篩選資料,並且以一行一行的方式輸出資料。

liaoost 發表於 2009-2-24 09:56

謝謝您的指導,我在試看看.

liaoost 發表於 2009-2-27 16:02

wmh~
我大致上已實作完成. 謝謝你的指導... ~^.^~
請參考 [url]http://www.dotblogs.com.tw/kinyo1978/archive/2009/02/27/7315.aspx[/url]

wmh 發表於 2009-2-27 17:54

不錯喔,改了那麼多 autocomplete 的 code,應該是花了不少時間研究 :)

我應該是沒有幫到什麼,不過非常歡迎你來這邊分享心得喔。

頁: 1 [2] 3 4 5 6 7

Powered by Discuz! Archiver  © 2001-2009 Comsenz Inc.