Query SP Lists, Display Item and Edit

Feb 2, 2011 at 2:41 AM

Gents,

Can't really express how exciting it was to come across the site.  I'm new to SharePoint, new to developing and some of the code I am finding is still a little confusing.  Some of the examples seem like really great tools.  I have a specific issue I want to resolve and not sure how to use some of the tools.  Native Search function in SharePoint doesn't always return the prettiest result.  I am looking to Query an SP list, return a select group of field as a preview and allow the user to select the item and be directed to the disp.aspx page so they can view all the fields or edit if necessary. 

Thank you in advance for your response and this great resource.....

jb

Coordinator
Feb 4, 2011 at 12:45 AM
Edited Feb 4, 2011 at 2:55 PM
jman2904,
.
You should look at the examples on the sharejPoint.com website, http://www.sharejpoint.com/examples/src/jPListInspector.aspx. Username: demouser, password: sharejPoint!
The jPListInspector shows you several examples of how to retrieve the items of a list. Your solution could use one of the following two examples on this page:
.
jPListInspector Example: filterItems to get default view
var siteurl = "http://www.sharejpoint.com/examples";
var listname = "ADemoList";
jP.Lists.setSPObject(siteurl, listname).getSPView(); 
.
This retrieves the items from the default view. To retrieve the fields in another view, call .getSPView([your_viewname]).
To put the results into a table, use the XML results in jP.Lists["ADEMOLIST"].xmlDoc or iterate through the items in jP.Lists["ADEMOLIST"].Items. You can create a link to the DispForm of each item simply by: var dispForm = siteurl + "/dispform.aspx?ID=" + jP.Lists.ADEMOLIST.Items[0].ID
.
.
jPListInspector Example: getItemsFieldData
.
var siteurl = "http://www.sharejpoint.com/examples";
var listname = "ADemoList";
var fieldarray = ["LinkTitle","Status"]; /*array of field names that you want to appear in your table*/
var mylist = jP.Lists.setSPObject(siteurl, listname);
var qry = "<OrderBy><FieldRef Name='ID' Ascending='TRUE' /></OrderBy>";
mylist.getSPItemsWithQuery(qry);
var myitems = mylist.getItemsFieldData(fieldarray);
.
This retrieves the items with the fields that you specify. The table results for the above example look like:
 
 
LinkTitle Status
Sample Task In Progress
tyfghfghgf Not Started
what happens? Completed
test123 Not Started
test Not Started
Antidisestablishmentarianism Completed
this is my new test Not Started
.
Go to the examples website and try it yourself.
.
Thanks,
Will
On Tue, Feb 1, 2011 at 9:41 PM, jman2904 <notifications@codeplex.com> wrote:

From: jman2904

Gents,

Can't really express how exciting it was to come across the site. I'm new to SharePoint, new to developing and some of the code I am finding is still a little confusing. Some of the examples seem like really great tools. I have a specific issue I want to resolve and not sure how to use some of the tools. Native Search function in SharePoint doesn't always return the prettiest result. I am looking to Query an SP list, return a select group of field as a preview and allow the user to select the item and be directed to the disp.aspx page so they can view all the fields or edit if necessary.

Thank you in advance for your response and this great resource.....

jb

Read the full discussion online.

To add a post to this discussion, reply to this email (jPoint@discussions.codeplex.com)

To start a new discussion for this project, email jPoint@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com