Qhov no yog ib qho rau kuv kuas series yuav ua li cas los siv jQuery nrog SharePoint.
Yog koj xav paub ntau ntxiv txog cov jQuery, Kuv mas xav: jQuery hauv nkaus ntawm Xyooj Bibeault thiab Yehuda Katz.
Tau pib nrog jQuery nyob SharePoint yog ib qho yooj yim kuj ceeb tias (rau kuv). (Kuv muaj lus nug heev txog peb ua ib tug "zoo kev" hauj deploying tej no mus ntau lawm, tiam sis yog lwm hnub). Kuv twb nyuam qhuav pib ua si nrog cov tshuab no thiab qhov kawg, Kuv tsim ib cheeb tsam sandbox siv. Yog koj nyob nraum nrhiav kom tau pib nrog jQuery, koj yuav nrhiav no mus kom ze pab tau.
1. Ua kom muaj ib qhov chaw dawb paug
Tsim ib cov dawb paug rau qhov chaw nyob hauv koj qhov chaw thiab hu xov tooj rau nws tej yam ntse ib yam li "jQuery Sandbox".
2. Download tau jQuery
Koj mus muab tau lub tsev qiv ntawv javascript jQuery ntawm no: http://docs.jquery.com/Downloading_jQuery
Uas yuav txuag tau koj desktop.
Kuv yeej tau siv cov "minified" version.
3. Tsim ib lub tsev qiv ntawv SharePoint daim ntawv
Nyob rau hauv koj lub chaw sandbox, ua ib daim ntawv qiv.
4. Upload jQuery tsev qiv ntawv los SharePoint
Ntaub ntawm doc qiv koj nyuam qhuav tsim thiab upload lub tsev qiv ntawv jQuery.
5. Tsim ib daim ntawv teev kev cai SharePoint
Kuv twb pib nrog rau ib daim ntawv teev kev cai vim kuv xav muck uas txheem ntaub ntawv SharePoint. Koj yuav kuj ua kom ib sab nyob rau hauv ib lub tsev qiv ntawv sau los yog nplooj ntawv qhov web thiab tej zaum ntau ntau qhov chaw.
Ntxiv ib co txhua daim ntawv kev cai kom koj muaj ib yam dab tsi kom khiav jQuery tiv thaiv. Kuv thiaj pib ua tiav lawm:
- Nkaum teb.
- Cob ib tug nqi rau ib lub teb.
Cov hom phiaj ntawd hauv siab, Kuv ntxiv ob phau ntawv teb. Thaum lub sij hawm, Ua kuv mam li ua si nrog kev mus, dluab, lookups, yam.
6. Hloov cov nplooj ntawv Part NewForm.aspx Web thiab ntxiv lub ntsiab lus Editor Web site qhov
Qhov no nws yog me ntsis dub magic-ish , rau qhov hais tias nws yog lub tswvyim tshiab rau kuv. Kuv xub kawm txog qhov no los ntawm Paul Grenier, SharePoint jQuery Superstar, nws CodePlex yog ib qhov site: http://spff.codeplex.com/.
Ua raws li cov kauj ruam mus ntxiv ib CEWP mus rau ntawm nplooj ib yam uas pom tias yog NewForm.aspx txog tej kev cai:
- Saib daim ntawv kev cai thiab nyem qhov New.
- Append hauv qab no rau qhov URL: PageView = koom&ToolPaneView = 2
Uas yuav txia koj boring vanilla tej ntaub ntawv nkag teb chaws daim ntawv los ntawm tej yam zoo li no:
Rau qhov no:
Ntxiv cov editor web ib sab mus rau sab.
7. Sau koj cov thawj jQuery Code
Qhib tau ntawd CEWP hauv txoj cai saib thiab ntxiv cov nram qab no:
Nov yog lub chaws txoos yog koj xav luam los muab tshuaj:
<tsab ntawv yam ="ntawv nyeem/javascript"
src =".. /.. /jQuery Library/jquery-1.3.2.min.js">
</tsab ntawv>
<Script yam ="ntawv nyeem/javascript">
$(muaj nuj nqi() {
$('#resultsID').html('Muaj cov' + $('ib').loj() + 'ib cim npe cim npe rau phab no.');
});
</tsab ntawv>
Ntog:
<div daim id ='resultsID'></div>
/ntog
|
Nco ntsoov tias tus ua ntej <tsab ntawv> lossis referencing lub tsev qiv ntawv sij jQuery. Txawm, tej no hloov lub sij hawm, ces koj mam li xav kom koj ib tug) siv lub npe zoo thiab b) taw tes rau qhov tseeb SharePoint daim ntawv qiv.
Bask hauv lub hwjchim ci ntsa iab
Yog tias koj ua nws thwj, koj yuav pom muaj tshwm sim zoo li cov nram no:
Wrapping tuaj
Qhov no tsis yog tib txog kev mus pib, tiam sis nws tseem ceev, ib qho yooj yim thiab hauv koj ib SharePoint nyob.
</kawg>
Subscribe rau kuv blog.
Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin