Taylor Scott

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Rebinding HTML tags to form fields #26012
    Taylor Scott
    Participant

    This works great also, here’s how I’m using it:

    
    
    function customLiveUpdate(){
    	// to work correctly the binders must have the correct class and prefix of element id
    	// the id with the prefix must end in the fin
    	var binderClass = 'p3binderClass';
    	var prefix = 'p3binder_';
    	var f = '';
    //	var customUpdateliveObj = {};
    	var updateTimeout = {};
    	var eleId = '';
    	
    	    $("span[class^='" + binderClass + "']").each(function(){
    				eleId = $(this).attr('Id');	
    				f = eleId.substring(prefix.length);	    	
    	    		
    	    		bindFieldUpdate(f);
    	    		
    	    });
    	    
    	function bindFieldUpdate (f) {
    	    if (updateTimeout[f] === undefined) {
    	        updateTimeout[f] = 0;
    	    }else{
    			// Only bind once to each field
    			return;
    	    }
    		var update = function(f){
    			jQspjs("#" + prefix + f).html(spjs.utility.getFieldValue({ "fin": f, "delimiter": "; " }));
    	    }
    	    jQspjs("#dffs_" + f).find("select, input:radio, input:text:first, input:checkbox, .sp-peoplepicker-topLevel")
    	    	.on("change blur", function(e) {
    	        	clearTimeout(updateTimeout[f]);
    	        	updateTimeout[f] = setTimeout(function () {
    	            	update(f);
    	        	}, 10);
    	    	});
    		update(f);
    	}

    ^ whenever I load a new html file into a placeholder (I swap them regularly) I call customLiveUpdate(). It seems to work well. It looks like I can call it as often as a I want and since I’m just using your existing binding all I’m doing is adding a timeout (and not duplicating right)? The only thing I’m unclear about is where the updateTimeout object lives in scope. Since it’s called and instantiated each time I call won’t it recreate and thus reset the timeout even if one existed?

    in reply to: Rebinding HTML tags to form fields #25972
    Taylor Scott
    Participant

    This is pretty fantastic, and it works well. Any idea what sort of performance it would get if I filled up the object with a few dozen fields throughout the course of the form?

    in reply to: Sorting SPJS Lookup in descending order #25676
    Taylor Scott
    Participant

    Hi Alex, I’m having a similar issue. My vlookup is running on : v2.2.129, I’m calling the init function successfully w/ no probs, but recently tried to add a sort order. If I leave everything alone (default sort = Title) and change ascending to false (as a test) it still won’t sort descending. If I try to supply a fin to replace title it ignores it completely. I’m passing an object “dd” to the function that calls init() and no matter what I do I can’t change sort order:

    
    
    spjs.lookup.init({
        "fieldToConvertToDropdown": [
            dd.fieldName
        ],
        "listName": dd.listName,
        "listBaseUrl": siteUrl,
        "optTextFieldInternalName": dd.selectField,
        "pipeDelimitedOptions": "false",
        "optValFieldInternalName": "ID",
        "orderBy": {
            "fin": dd.sortOrder,
            "ascending": true
        },
        "clearInvalidSelections": true,
        "filterObj": {
            "on": dd.filterObject.filterOn,
            "folder": "",
            "CAML": dd.filterObject.CAML,
            "fin": dd.filterObject.fin,
            "isLookup": false,
            "operator": dd.filterObject.operator,
            "filterVal": dd.filterObject.filterVal
        },
        "dropDownDefaultvalue": "",
        "allowBlank":true,
        "parseFunction": "",
        "addYouOwnValue": {
            "on": false,
            "linkText": "Write your own value"
        },
        "addToExternalList": {
            "on": false,
            "customFunction": null,
            "linkText": "Add new item",
            "saveNewItemText": "Save new item"
        },
        "debug": false,
        "customSort": ""
    });

    Can you help?

Viewing 3 posts - 1 through 3 (of 3 total)