Return to Snippet

Revision: 69269
at May 21, 2015 00:43 by cookiejest


Initial Code
app.getList("CurrentSelections", function(reply) {
        
	selectionslist ="";

	var mySelectedFields = reply.qSelectionObject.qSelections;

	console.log(mySelectedFields);

//loop through selected fields
	var mySelectedFields_arrayLength = mySelectedFields.length;
	for (var i = 0; i < mySelectedFields_arrayLength; i++) {

		var text = mySelectedFields[i].qField + " ";

	    //console.log(mySelectedFields[i].qField);


				if(mySelectedFields[i].qLocked==true) {
					var labeltype = 'label label-warning'
				} else {
					var labeltype = 'label-success';
				}
				
				console.log(mySelectedFields[i].qLocked);

	    	//loop through selected field values
			var currentFieldValues = mySelectedFields[i].qSelectedFieldSelectionInfo


			var currentFieldValues_arrayLength = currentFieldValues.length;
			
			for (var y = 0; y < currentFieldValues_arrayLength; y++) {

			    //console.log(currentFieldValues[y].qName);

				//text += currentFieldValues[y].qName + " ";

				



				text += "<span class='label " + labeltype + "'>" + currentFieldValues[y].qName + "</span> ";
				//put the field names into a variable

				//console.log(text);
			}

		if(i==0) {
			selectionslist = text;
		} else {
			selectionslist += text;
		}

		//add the complete string for this field to an array.
	


	}

console.log(selectionslist);
$("#myselections").html(selectionslist);


        
       
     });

Initial URL


Initial Description
This is the code for listing out the current selections.

Initial Title
Custom current selections

Initial Tags


Initial Language
JavaScript