讓 YUI DataTable 使用 JSON Data Over XHR 時支援中文 field

原由

YUI 真是個好東西,最近拿它來寫公司的程式。
天殺的! 不知以前是誰把資料庫欄位都用中文命名。
我輸出 JSON 長這樣...


{
 "ResultSet": {
  "Result": [{
   "ID": "1234",
   "姓名": "林洵賢",
   "電話": "1234567890"

... 省略

話說當今瀏覽器 UTF8 編碼的頁面 JavaScript 運作起來是沒什麼問題。
但 YUI 是外國人設計的,用它的 DataSource 抓資料後認為這些以中文為 key 的是壞東西會自動被忽略。


解決

追程式囉! 我原本是用 DataTable 當然從它開始追,追到另一個模組 DataSource 找到了!
我用的是 YUI 2.9 版,修改 \build\datasource\datasource*.js 原始程式,把

[^\w\.\$@]

改成

[^\w\.\$@\u4e00-\u9fa5]

就支援中文 key 了。


或許這篇算是寫給自己的筆記,沒接觸過的應該看沒有。
如果你不幸也在找同樣的解決方案 google 到我,那恭喜你囉,留個言吧!


後記
後來發現欄位排序中文Key也有問題,要修改 datatable*.js 尋找 [^\w\-] 改為 [^\w\-\u4e00-\u9fa5] 即可。

27 個回應:

Fangyaya 提到...

michael kors handbags
louis vuitton outlet
toms shoes
coach factory outlet online
beats headphones
lebron james shoes
nike air force
coach outlet online
coach outlet
kate spade handbags
michael kors handbags
polo ralph lauren
michael kors outlet clearance
true religion
basketball shoes
christian louboutin shoes
louis vuitton bags
ray ban sunglasses outlet
toms shoes
kate spade outlet
cartier watches
polo ralph lauren
jeremy scott shoes
michael kors handbags
timberland outlet
kate spade handbags
ray ban sunglasses
oakley sunglasses wholesale
jordan 6
oakley sunglasses
instyler curling iron
jordan concords
lebron james shoes 13
adidas nmd
kate spade
toms
20167.26chenjinyan

chenmeinv0 提到...

north face jackets
moncler coats
fitflop shoes
ugg outlet
ray ban outlet
canada goose sale
nike tn pas cher
michael kors outlet
oakley sunglasses outlet
pandora jewelry
2016.10.27xukaimin

chenlina 提到...

ralph lauren
oakley sunglasses canada
north face jackets
ugg boots
ray ban wayfarer
cheap basketball shoes
nike air max
cheap mlb jerseys
coach outlet
nike roshe run
chenlina20170109

Unknown 提到...

coach outlet
tiffany outlet
canada goose outlet
michael kors outlet
ed hardy
birkenstocks
air jordan retro
yeezy boost
longchamp uk
cheap oakley sunglasses
20170224caiyan

chenlina 提到...

coach outlet
oakley sunglasses wholesale
ralph lauren uk
louis vuitton outlet online
gucci shoes
michael jordan shoes
clarks shoes
polo ralph lauren
rolex datejust
hermes uk
chenlina20170720

Unknown 提到...


Furniture move
he majority of DIY home movers are really interesteD in knowing how to properly loaD their renteD moving vehicles so that the entire storage spACe is utilizeD in the Best possiBle way. نقل عفش بالرياض The main concern for families who have DeciDeD to move on their own still remains the Danger of choosing a moving truck with insufficient spACe for their Belongings. شركة شراء اثاث مستعمل بالرياض To complicate things further, even the right choice of a rental moving vehicle can easily turn out to Be a serious proBlem if the loaDing process is not Done the right way.افضل شركة نقل عفش بينبع AnD Believe us, leaving prizeD possessions BehinD or Being forceD to make two trips are two moving scenarios you Don’t really want to go through for various reasons.شركة نقل اثاث بجدة - افضل شركة نقل عفش بالمدينة المنورة
EveryBoDy knows that when given at the right time, gooD moving aDvice can mean the worlD to stresseD home movers, anD will prove to Be the Difference Between a successful house move anD a Disastrous proBlem-filleD relocation. افضل شركة تخزين اثاث بالرياض This is why, having alreaDy DescriBeD in Details the truck loaDing process anD the way to overcome its challenges, it’s only fair that we say a few worDs aBout how to unloaD a moving truck once you have reACheD your Destination.

cara menggugurkan hamil 提到...

now present in your city
1. manfaat kurma untuk persalinan
2. manfaat buah nanas
3. aktivitas penyebab keguguran
4. apakah usg berbahaya
5. penyebab telat haid
6. cara melancarkan haid
7. cara mengatasi keputihan
8. tanda tanda menopause

klinik aborsi jakarta 提到...

Klinik Aborsi Jakarta
Klinik Aborsi Raden Saleh
Klinik Kuret Jakarta
Klinik Kuret
Klinik Raden Saleh
Klinik Aborsi Aman
Klinik Aborsi
Klinik Aborsi Legal
Biaya Aborsi

SEOrank 提到...

Now, if you are the registered employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits info or register at BofA Resources At Home website then get easy instructions shown below now. 메이저사이트

SEOrank 提到...

Now, if you are the registered employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits info or register at BofA Resources 스포츠사이트

SEOrank 提到...

if you are the registered employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits info or register 사설토토

SEOrank 提到...

employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits info 먹튀검증사이트

SEOrank 提到...

authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits 안전놀이터

SEOrank 提到...

Now, if you are the registered employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee 토토사이트

SEOrank 提到...

if you are the registered employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits info or register 먹튀폴리스

SEOrank 提到...

It is great to have visited your website. Thanks for sharing useful information. And also visit my website about health. God willing it will be useful too 스포츠사이트

SEOrank 提到...

if you are the registered employee or an authorized associate working for one of the largest banking institutions in the country and want to access Bank of America Employee Benefits 메이저사이트

SEOrank 提到...

if you are the registered employee or an authorized associate working for one of the largest nba중계

SEOrank 提到...

Thank you for any other informative blog. Where else may just I am getting that kind of information written in such a perfect method 카지노사이트

SEOrank 提到...

employee or an authorized associate working for one of the largest 먹튀검증

온라인카지노사이트 提到...

온라인카지노사이트 Hello! This is my first visit to your blog! We are a group of volunteers and starting a
new initiative in a community in the same niche. Your blog provided us
valuable information to work on. You have done a marvellous
job!

온라인카지노사이트 提到...

카지노사이트 We stumbled over here from a different web page and thought I should check things out. I like what I see so now i’m following you. Look forward to looking at your web page yet again.|

토토365프로 提到...

토토 I have read your blog and I gathered some new information through your blog. Thanks for sharing the information

메이저사이트 목록 提到...

메이저사이트 Hi, just wanted to say, I loved this post. It was practical. Keep on posting!

Unknown 提到...

youtube abone satın al /n trendyol indirim kodu
cami avizesi
cami avizeleri
avize cami
no deposit bonus forex 2021
takipçi satın al
takipçi satın al
takipçi satın al
takipcialdim.com/tiktok-takipci-satin-al/
instagram beğeni satın al
instagram beğeni satın al
btcturk
tiktok izlenme satın al
sms onay
youtube izlenme satın al
no deposit bonus forex 2021
tiktok jeton hilesi
tiktok beğeni satın al
binance
takipçi satın al
uc satın al
sms onay
sms onay
tiktok takipçi satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
instagram beğeni satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
takipcialdim.com/instagram-begeni-satin-al/
perde modelleri
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
betboo
marsbahis
sultanbet

Yenipolat Aslantaş 提到...

film izle - sex hikayeleri - sex hikayesi - erotik hikaye -
ankara escort - bornova escort - alsancak escort - çeşme escort - izmir escort - smm panel - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - haber - instagram takipçi hilesi - instagram takipçi satın al - ​izmir evden eve nakliyat - seocu - instagram takipçi hilesi - instagram takipçi satın al - izmir escort - takipçi satın al - instagram takipçi satın al - tiktok takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takibi bırakanlar - buca escort -
karşıyaka escort

Unknown 提到...

instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
takipçi satın al
aşk kitapları
tiktok takipçi satın al
instagram beğeni satın al
youtube abone satın al
twitter takipçi satın al
tiktok beğeni satın al
tiktok izlenme satın al
twitter takipçi satın al
tiktok takipçi satın al
youtube abone satın al
tiktok beğeni satın al
instagram beğeni satın al
trend topic satın al
trend topic satın al
youtube abone satın al
beğeni satın al
tiktok izlenme satın al
sms onay
youtube izlenme satın al
tiktok beğeni satın al
sms onay
sms onay
perde modelleri
instagram takipçi satın al
takipçi satın al
tiktok jeton hilesi
pubg uc satın al
sultanbet
marsbahis
betboo
betboo
betboo

張貼留言