Alexander Bautz

Forum Replies Created

Viewing 15 posts - 4,051 through 4,065 (of 4,536 total)
  • Author
    Posts
  • in reply to: Show info on predecessors in DispForm of tasks list #8849
    Alexander Bautz
    Keymaster

    Here is an updated code to fix a bug with selecting one item from a multilookup column (thanks to Ferdi Lethen):

    function showPredesessors(){
    	var listTitle = "Tasks", pArr = spjs.dffs.beforeProperties.Predecessors, qb = [], cc, q, list, items, res = [];
    	if(pArr.length === 0){
    		$("#PutPredecessorsHere").html("No items found");
    		return;
    	}
    	cc = new SP.ClientContext.get_current();
    	list = cc.get_web().get_lists().getByTitle(listTitle);
    	qb.push("<View Scope='RecursiveAll'><Query>");
    		qb.push("<Where>");
    		qb.push("<In>");
    			qb.push("<FieldRef Name='FieldNo' />");
    				qb.push("<Values>");
    				if (pArr.length === 1){
    					qb.push("<Value Type='Text'>"+pArr[0]+"</Value>");
    				} else {
    					$.each(pArr,function(i,t){
    						qb.push("<Value Type='Text'>"+t+"</Value>");
    					});
    				}
    			qb.push("</Values>");
    		qb.push("</In>");
    		qb.push("</Where>"); 
    	qb.push("</Query></View>");
    	q = new SP.CamlQuery();
    	q.set_viewXml(qb.join(''));
    	items = list.getItems(q);
    	cc.load(items);
    	cc.executeQueryAsync(
    		function(sender, args){
    			var e = items.getEnumerator();
    			res.push("<table cellpadding='2' cellspacing='0'>");
    			res.push("<tr>");
    			res.push("<th valign='top'>Title</th>");
    			res.push("<th valign='top'>% Complete</th>");
    			res.push("</tr>");
    			while(e.moveNext()){
    				item = e.get_current();
    				res.push("<tr>");
    				res.push("<td valign='top'>"+item.get_item("Title")+"</td>");
    				res.push("<td valign='top'>"+(item.get_item("PercentComplete") !== null ? (item.get_item("PercentComplete") * 100) + " %" : "")+"</td>");
    				res.push("</tr>");					
    			}
    			res.push("</table>");
    			$("#PutPredecessorsHere").html(res.join(""));
    		},
    		function(sender, args){
    			alert(args.get_message());
    		}
    	);
    }
    in reply to: Custom JS [Retrive Value from Lookup Table] #8846
    Alexander Bautz
    Keymaster

    Hi,
    Can you give me some more information about how you plan to use use this? Do you use this as a lookup reference for manually filling in other fields in the form based on the returned value, or do you save the selected value(s) to the list to “use” then later?

    The code is designed to pull in the value saved in the field, and not the current selected value when you do the selection so it will need a change to work “live”.

    Alexander

    in reply to: Overlay strangeness #8834
    Alexander Bautz
    Keymaster

    I did some more tests and will post an updated version of DFFS with an attempted fix for the overlay later tonight.

    Alexander

    in reply to: Overlay strangeness #8832
    Alexander Bautz
    Keymaster

    I did change the overlay code a bit in the later versions, but I cannot see why it should have a delay when inserting. Are you able to locate the problem when you compare the old and the new overlay?

    Alexander

    in reply to: Unable to get value of the property 'toString' #8830
    Alexander Bautz
    Keymaster

    Hi,
    I’m sorry, but it’s not easy to tell. I suspect it must have something to do with the internal functions in DFFS being confused when the datepicker is not looking like it expects.

    I have had one other report on a similar issue, and will try to prevent this error in the next release, but this is not guaranteed to work.

    Alexander

    in reply to: Overriding DFFS Close button behavior on DispForm #8828
    Alexander Bautz
    Keymaster

    Try this in the custom js in DFFS:

    $("input[id$='diidIOGoBack']").attr("onclick","window.history.back()");

    Alexander

    in reply to: vLookup on new item on document library #8826
    Alexander Bautz
    Keymaster

    Sorry fro the delay. I have now tested it and confirmed your finding. It was a shortcoming in my code that did not “see” the ID because it was not the first parameter in the URL.

    I will fix this in the next release – hopefully during the weekend.

    Sorry for the inconvenience,
    Alexander

    in reply to: Overlay strangeness #8822
    Alexander Bautz
    Keymaster

    Could it be that the CEWP with the overlay is not placed above the form web part?

    Alexander

    in reply to: Overlay strangeness #8807
    Alexander Bautz
    Keymaster

    Hi,
    Are you using the JSLink version? – if so, try to move the DFFS_loader field to the top of the list (column ordering in list settings).

    Alexander

    in reply to: Unable to get value of the property 'toString' #8805
    Alexander Bautz
    Keymaster

    If you click the error in the dev console and show me the code snippet where the error originates from I might see what is wrong.

    Alexander

    in reply to: Create from Existing item in vLookup #8779
    Alexander Bautz
    Keymaster

    Hi,
    Sorry for the delay in answering. I currently don’t have a ready solution for copying a list item, but basically what you need to do is to use a query to find the values you want to copy, and then add a new item with the data.

    Here is a basic example:

    function copyListItem(itemToCopy){
    	var oRes, viewFields = ["Title","AssignedTo"], data = {};
    	oRes = spjs.utility.getItemByID({"listName":"Tasks","id":itemToCopy,"viewFields":viewFields});
    	if(oRes !== null){
    		$.each(oRes,function(key,val){
    			if(key !== "ID"){
    				data[key] = val;
    			}	
    		})
    		nRes = spjs.utility.addItem({"listName":"Tasks","data":data});
    		if(!nRes.success){
    			alert("ERROR:\n"+nRes.errorText);
    		}else{
    			alert("A new item with ID "+nRes.id+" was created.");
    		}
    	}else{
    		alert("No item found");
    	}
    }

    You must know the ID of the item you want to clone – and call the function like this:

    copyListItem(123);

    Where 123 is the ID of the list item you want to clone.

    In this function you must insert the FieldInternalNames in the ViewFields array, and change the list display name from “Tasks” to you lists display name or GUID.

    Let me know how this works out.

    Alexander

    in reply to: Using DFFS in Mobile view #8777
    Alexander Bautz
    Keymaster

    Hi,
    Sorry for the delay. I’m sorry, but I have no solution for “mobile view” as this is not accessible in the same way as the “default” form.

    Alexander

    in reply to: Custom JS [Retrive Value from Lookup Table] #8775
    Alexander Bautz
    Keymaster

    Sorry for not replying – I have had some trouble with notifications form the forum.

    Yes, you should be able to use the linked post – her is an example based on the code form the linked post:

    function getLookupExtraFieldValue(){
    	var val = do_getLookupExtraFieldValue();
    	alert(val);
    }
    
    function do_getLookupExtraFieldValue(){
    	var data, lookupValue, b;
    	data = spjs.utility.getItemByID({"listName":_spPageContextInfo.pageListId,"id":spjs.dffs.data.thisItemID,"viewFields":["PutYourFieldInternalNameHere"]});
    	lookupValue = data["PutYourFieldInternalNameHere"]; 
    	if(lookupValue !== null){
    		return lookupValue;
    	}
    }

    Change “PutYourFieldInternalNameHere” with you fieldname. Then call “getLookupExtraFieldValue” to test the return value.

    Let me know if you have any questions.

    Alexander

    in reply to: Multiple related fields #8770
    Alexander Bautz
    Keymaster

    Thats good. The 500 error is the first query encountering the “throttling threshold”. It then resets and uses another method for querying in chunks of 5000 items.

    Alexander

    in reply to: Cascading Drop Down when more than 5000 items? #8764
    Alexander Bautz
    Keymaster

    I’m glad it worked technically, but as you have observed the load time will suffer – especially in older IE versions.

    You might be able to use the Autocomplete plugin – have you looked at this one for this scenario?

    Alexander

Viewing 15 posts - 4,051 through 4,065 (of 4,536 total)