Hii ni baada ya mwingine katika wangu inayoendelea mfululizo ya jinsi ya kutumia jQuery na SharePoint.
Kama unataka kujifunza zaidi kuhusu jQuery, Mimi sana kupendekeza: jQuery katika Action na kubeba Bibeault na Yehuda Katz.
Hapo awali, I wrote about how to use jQuery to locate and hide a text field on a form. I didn’t care for the specific approach (Nilikuwa chaining wazazi - kwamba tu si kufanyika siku hizi, angalau katika familia ya ubora).
Wakati mimi kwanza kuanza kufikiri juu yake, Nilijua zinahitajika ili kupata <TR> ambayo mimi naweza kujificha waomba() njia. My early effort to find the correct <TR> ilikuwa kitu kama hii:
$('Tr:ina(pembejeo[title = Ficha Me!])');
tatizo na kwamba ni kwamba itakuwa kupata kila <TR> tag that had any parent relationship to the Hide Me! shamba, hata kama Ficha Me! ni Furushi ngazi nyingi kirefu katika <TR>’s. It turns out that on my sandbox form, kujieleza kwamba hupata 9 tofauti ya TR ambao Ficha Me! as a child somewhere in its DOM tree. I realized that I could walk back up the tree from the input field itself, hivyo kwamba ni jinsi gani mimi kuishia wazazi kutumia vibaya, lakini hawakuwa kukaa vizuri na mimi.
Mimi alitoa mawazo ya baadhi ya hii na moja ya mambo ya mimi kusoma hatimaye alifanya akili: Mimi naweza kutumia si() njia ya trim nje <TR>’s I don’t want in my wrapped set. Kwamba aliniongoza hii:
$('Tr:ina(pembejeo[title = Ficha Me!])').si('Tr:ina(tr)').kujificha();
kwanza kidogo anaona kila <TR> vitambulisho ambayo Ficha Me! field anywhere in their own hierarchy. It then strips out any <TR> kwamba pia mtoto <TR>. This leaves us with a single <TR> kwamba:
1) Hana <TR> mtoto kumbukumbu
2) Does have the input field as child.
Tunaweza kisha kuomba kujificha() njia ya kuweka kusababisha na sisi ni kosa.
Mimi bado kidogo neva kuhusu hili, lakini si kama neva kama wazazi chaining.
I don’t know if this is a best practice or not. There may be a more appropriate way of identifying just the <TR> that we care about in a SharePoint form. If you know, tafadhali post comment.
</mwisho>
Kufuata yangu juu ya Twitter kwa http://www.twitter.com/pagalvin
Hi Paulo,
Paulo Culmsee ya workarounds Clever aliandika makala kuhusu suala sawa (kutafuta TR sahihi kuficha shamba) kutumia JavaScript wazi, si jQuery. Yeye kupatikana kwa njia zima kupata TR kuficha, ni mwisho wa blogpost hii : http://www.cleverworkarounds.com/2008/02/07/more-sharepoint-branding-customisation-using-javascript-part-1/
matumaini inasaidia,
Jonathan
Pingback: Kujificha shamba katika fomu SharePoint hariri msingi ya maadili mengine « jbmurphy.com