Cross site lookup jpart - works! (sometimes)

Nov 5, 2009 at 5:57 PM

I am trying to use the new cross site lookup jpart that Ken has built (Thanks Ken!). It doesn't seem to pull data reliably. I set a breakpoint in the cross site code (line 196) where the objarray should contain all the values to be utilized. I get some wierdness here. First, a clip of the code (Ken's)

		var fields = [];
		//fields.push(opts.LookupFieldName);
		if (opts.LookupShowDetail == "true") {
			var cols = opts.LookupDetailFieldDefinition.split(";"); 
			$.each(cols, function(){
				var fld = this.split("|")[0]
				fields.push(fld);				
			});
		}
		var objarray = getAttrs(data,fields);
		return objarray;
		
		//if(spl.JQueryData[0] != null)

Now a look at the values with the breakpoint triggered:

 Object Arry

 

Notice that the nodes in the objarray have different levels of data? The source list has 5 columns (three are text) with all rows containing complete data.

What could be causing the partial data?

Coordinator
Nov 5, 2009 at 6:31 PM

This is because row attributes are only available for non-blank fields.  I'm putting a fix for this now.

 

Nov 5, 2009 at 7:27 PM

Do you mean non-blank fields in the list being looked up? or related to the field that is the target? I find that if I do not include the field used for the target in the detail list, the query fails and each call to build the dropdown alerts with the usage message.

Coordinator
Nov 5, 2009 at 7:32 PM

The info box should only display data that is available.  So if a record has no LinkTitle, you won't see it in the info box.

Are the columns BU, LinkTitle, and OCA included in your default view?  Can you send me the xml response that came back from the Lists.asmx GetListItems webservice call?  In firebug switch over to Console, expand the Post call and copy & email me the xml in the response tab.

ken.k.le@gmail.com

Coordinator
Nov 6, 2009 at 4:43 AM

Ken,
I am always getting the info box, but the last two fields are not getting populated. I can see the data in the response but it doesn’t make it to the box. If I get a chance I will step through the code.  BTW, I see a lot of value in making a general purpose function that builds a JSON from the JQuery data. In many cases I am rewriting the scan/covert loops to pull the data from the query. I can almost pull it from your code, but there is assumed location of some of the jPoint structure. Since the JQuery data is transient, I have to always build something from it.

Bill

 

Coordinator
Nov 6, 2009 at 4:44 AM

Bill,

What are the names of the last two fields?
 
We getting ready to release an update to jPoint.  One major update is easier handling of response data from list webservices.  Xml row data will be automatically extracted out into array of field objects so you can get to the column values faster without writing those scan loops.  I will rewrite the cross-site lookup jPart and replace what it is doing now.

Ken

Coordinator
Nov 6, 2009 at 4:45 AM

Ken,
field names are Title,BU,BU Approver,Approver Name,OCA where BU Approver is a field type from the person lookup. The rest are Text. In my info box I cannot get either field with a blank in the name to show data. I still get confused on when jPoint tosses blanks, expects _x0020_, or the actual blank.
 
Bill

 

Coordinator
Nov 6, 2009 at 4:45 AM

Bill,

Yes! You found the problem.  Download the new version
 
http://www.sharejpoint.com/src/jPoint/webparts/jPart.crossSiteLookup.js
 
Use ApproverName|Approver Name|Text;BUApprover|BU Approver|Text
 
Basically strip out all special characters and blank to use for field reference.
 
This will be part of the next release of jPoint.  You will see the referenceable field names in the object view.

Ken

 

Coordinator
Nov 6, 2009 at 5:52 AM

Bill,

Thank you for comments.

GJ Ken with some nice responses!

Apr 15, 2010 at 4:23 AM

Is it right yo have Project_x0020_Name in LookupFieldName
Its giving js alert for _x0020_, or if i give actual blank.