<params>
A utility class for manipulating name-value pairs

JavaScript: lz.params
extends lz.Eventable »

lz.Param provides utilities for manipulating name-value pairs. For example, lz.Param objects can be used to manage a name/value pairs for an HTTP request.

     <method name="sendData" args="action">
         var d=canvas.datasets.dsSendData;
         var p=new lz.Param();
         p.addValue( "action", action, true);
         p.addValue( "firstName", "Bob", true);
         p.addValue( "lastName", "Jones", true);
         p.addValue( "phone", "415-255-2392", true);
         p.addValue( "email", "bob@jones.com", true);
         d.setQueryString( p );
         d.doRequest();
     </method>
 

Methods

addObject()
params.addObject(o : Object);
Adds a series of name/value pairs from an object
Parameter Name Type Description
o Object An object containing name/value pairs to add

addValue()
params.addValue(name : String, val : String, enc : Boolean);
Adds a value. Does not replace existing entries with the same name.
Parameter Name Type Description
name String The name to set - must evaluate to a string
val String The value to set
enc Boolean If true, URI-encodes the value

clone()
params.clone(arg);
Returns a clone of this lz.Param. Argument is deprecated.
Parameter Name Type Description
arg    
Returns Type Description
  lz.params  

getNames()
params.getNames();
Get a list of all names, not necessarily in order
Returns Type Description
  [String] A list of keys

getValue()
params.getValue(name : String);
Get a value by name
Parameter Name Type Description
name String The name to look up - must evaluate to a string
Returns Type Description
  String The value for the specified name

getValues()
params.getValues(name : String);
Get values by name
Parameter Name Type Description
name String The name to look up - must evaluate to a string
Returns Type Description
  [String] An array of values for the specified name

remove()
params.remove(name : String);
Remove specified value by name or all values if null
Parameter Name Type Description
name String The name of the value to remove. If null, removes all values

serialize()
params.serialize(sep : String, delim : String, uriencode : Boolean);
Returns a string representation using the current separator and delimiter
Parameter Name Type Description
sep String String to use as separator
delim String String to use as delimiter
uriencode Boolean If true, uri-encode values @return: String representation of parameters

setDelimiter()
params.setDelimiter(d : String);
Set delimiter string used between records in serialize();
Parameter Name Type Description
d String String to use as delimiter
Returns Type Description
  String Old delimiter

setSeparator()
params.setSeparator(s : String);
Set separator string used between name/value pairs in each record in serialize();
Parameter Name Type Description
s String String to use as separator

setValue()
params.setValue(name : String, val : String, enc : Boolean);
Sets a value. Replaces existing entries with the same name.
Parameter Name Type Description
name String The name to set - must evaluate to a string
val String The value to set
enc Boolean If true, URI-encodes the value

toString()
params.toString();
Returns a string representation using the current separator and delimiter
Returns Type Description
  String All names and values for this object

Methods inherited from lz.Eventable

destroy, setAttribute

Class Methods

parseQueryString()
lz.params.parseQueryString(query);
Parse a URL query string, returns an object with key-value pairs
Parameter Name Type Description
query    
Returns Type Description
  Object  

Events

Events inherited from lz.Eventable

ondestroy