இந்த என் மற்றொரு பதிவு தொடர் நடந்து பயன்படுத்த எப்படி jQuery ஷேர்பாயிண்ட் கொண்டு.
நீங்கள் jQuery பற்றி மேலும் அறிய விரும்பினால், நான் மிகவும் பரிந்துரைக்கிறோம்: அதிரடி ல் jQuery கரடி Bibeault மற்றும் Yehuda கட்ஸ்.
ஷேர்பாயிண்ட் உள்ள jQuery தொடங்குதல் வியப்பு எளிதானது (எனக்கு). (I do have serious questions about a “best practices” approach to deploying these things to production, but that’s for another day). I’ve just started playing with this technology and to that end, I created a sandbox environment to use. If you’re looking to get started with jQuery, you may find this approach useful.
1. Create a Blank Site
Create a blank site somewhere in your site and call it something clever like “jQuery Sandbox”.
2. Download jQuery
You can download the jQuery javascript library from here: http://docs.jquery.com/Downloading_jQuery
Save that to to your desktop.
I have been using the “minified” version.
3. Create a SharePoint Document Library
In your sandbox site, create a document library.
4. Upload the jQuery Library to SharePoint
Access the doc library you just created and upload the jQuery library.
5. Create a Custom SharePoint List
I’ve started with a custom list because I want to muck about with standard SharePoint forms. You could also create a page in a pages library or web part pages and probably a lot of other places.
Add some columns to the custom list so that you have something to run jQuery against. My initial objectives were to:
- Hide a field.
- Assign a value to a field.
With that objective in mind, I added two text fields. காலப்போக்கில், I’ll be playing with links, images, lookups, முதலியன.
6. Modify the NewForm.aspx Web Part Page and Add a Content Editor Web Part
This is a little black magic-ish , in that it’s a new concept to me. I first learned about this from பால் கிரேனியர், SharePoint jQuery Superstar, at his CodePlex project site: http://spff.codeplex.com/.
Follow these steps to add a CEWP to the same page that shows NewForm.aspx for any custom list:
- Access the custom list and click New.
- Append the following to the URL: PageView=Shared&ToolPaneView=2
That will transform your boring vanilla data entry form from something like this:
To this:
Add the content editor web part to the page.
7. Write Your First jQuery Code
Open up that CEWP in the code view and add the following:
Here’s the actual code if you want to copy/paste:
<ஸ்கிரிப்ட் "text/javascript" src ="../../jQuery%20Library/jquery-1.3.2.min.js"> </ஸ்கிரிப்ட்> <ஸ்கிரிப்ட் வகை ="text/javascript"> $(செயல்பாடு() { $('#resultsID').HTML('There are ' + $('a').size() + ' a tags tags on this page.'); }); </ஸ்கிரிப்ட்> முடிவு: <div id='resultsID'></div> /result |
Note that the first <ஸ்கிரிப்ட்> tag is referencing the actual jQuery library. Presumably, these things change over time, so you’ll want to make sure you a) use the right name and b) point it to the correct SharePoint document library.
Bask in the Glory
If you did it correctly, you’ll see a result similar to the following:
Wrapping Up
This isn’t the only way to get started, but it’s quick, easy and isolated from your existing SharePoint environment.
</இறுதியில்>
மணிக்கு ட்விட்டரில் என்னை பின் http://www.twitter.com/pagalvin
Have you noticed that adding CEWP in editform.aspx would break the page and version information section shows up in the UI? Any workarounds for this?
Anyone ?
Sorry for never responding. I hope you figured out your issue.