Haraka na Easy: Kutumia jQuery kwa Ficha Shamba Nakala ya kidato SharePoint

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.

UPDATE (tayari!): Sikuweza kufikiri ya njia bora ya Machapisho <TR> tag nataka kujificha na aliandika juu yake hapa. You may still find this article interesting anyway so I’m leavnig it up.

Nataka kuficha Nakala shambani, "Ficha Me!"Kama inavyoonekana:

image'

jQuery zifuatazo hana hila kwa ajili yangu:

<script aina ="text/javascript">

  $(kazi() {


    $('Pembejeo[title = Ficha Me!]').mzazi().mzazi().mzazi().kujificha();

  });

</script>

kanuni ni kusema, "Kupata mimi mashamba yote pembejeo ambao title = Ficha Me!. Kisha, kupata mzazi wake na kisha mzazi ijayo na * ijayo * mzazi (phew!) na waomba kujificha() njia juu ya jambo, chochote ni hutokea kwa kuwa.

I figured nje kwamba muundo mzazi na kuangalia HTML kwa fomu kuwa SharePoint umba kama inavyoonekana:

<TR>
    <TD nowrap="true" valign="top" upana="190px" darasani="ms-formlabel">
        <H3 darasani="ms-standardheader">
            <nobr>Kujificha Me!</nobr>
        </H3>
    </TD>

    <TD valign="top" darasani="ms-formbody" upana="400px">
        <!-- FieldName="Hide Me!"
                 FieldInternalName="Hide_x0020_Me_x0021_"
                 FieldType="SPFieldText"
        -->
        <span wewe="none">
            <pembejeo
                jina="ctl00$m$g_bdb23c2c_fde7_495f_8676_69714a308d8e$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$ctl00$TextField"
                aina="text"
                maxlength="255"
                id="ctl00_m_g_bdb23c2c_fde7_495f_8676_69714a308d8e_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_TextField"
                cheo="Hide Me!"
                darasani="ms-long" />
                <br>
        </span>


    </TD>
</TR>

Hii picha inaonyesha huo, lakini alama juu na wazazi:

image

mzazi wa kwanza (1) is a span tag. Span’s parent (2) ni tag TD na kisha hatimaye sisi kupata mzazi halisi nataka kujificha (3) ambayo ni tag TR yenyewe.

This is a pretty terrible approach I think because it’s extremely dependent on the very specific structure of this form. When SharePoint 2010 hutoka nje, this whole structure could change and break this approach. What I really want to do is craft a jQuery selector that is along the lines of “find me all the TR’s (na tu TR vitambulisho) kwamba kuwa mahali fulani katika watoto wao mambo ya shamba pembejeo ambao title = Ficha Me!". I starting from the bottom and moving up. Assuming I figure this out, Mimi itabidi baada updated "haraka na rahisi 'baada ya.

</mwisho>

Kujiunga na blog yangu.

Kufuata yangu juu ya Twitter kwa http://www.twitter.com/pagalvin

Wazo moja juu ya "Haraka na Easy: Kutumia jQuery kwa Ficha Shamba Nakala ya kidato SharePoint

  1. Jaap Vossers

    nini kuhusu mbinu hii kwa ajili ya kutafuta tr mzazi? Kwanza nodi katika ukusanyaji wa nodi babu kwamba ni tr mambo, kusababisha tr karibu mzazi.

    .wazazi("tr:first")

    Kujibu

Kuondoka Reply

Anwani yako si kuchapishwa. Mashamba required ni alama *