Methods

Top  Previous  Next

addInputControlButton(columnName)

Creates a custom button adjacent to the edit field identified by the columnName parameter

Returns

A reference to the created button

Parameters

columnName

string

The name of the column for which the input control button should be added

Run Sample

addLinkedControl( control)

Adds a linked child DbNetGrid or DbNetEdit to the control. Linked controls should have their properties assigned before being passed as an argument to the addLinkedControl method. There is no need to call the initialize method for linked controls as this is done automatically.
Parameters

control

object

Reference to the child grid or edit control.

Run Sample

addToolbarButton( index)

Adds a button to the toolbar.

Returns

A reference to the button
Parameters

index

number

The position in the toolbar where you would like the button added. If no index is supplied the button is added at then end of the toolbar.

Run Sample

bind(eventName, handler)

Binds a client-side function to an event
Parameters

eventName

string

Name of the event

handler

function

Reference to the client-side function

Run Sample

columnValue(columnName)

Returns the current value for an edit field for the supplied column name

Returns

The edit field value as a string
Parameters

columnName

string

Name of the column

Run Sample

executeQuery(sql, parameters)

Returns a array of objects containing column values for the selected database records. All property names are lowercase.
Parameters

sql

string

Sql statement to be executed

parameters

object

Parameter values for any parameter placeholders in the sql property

executeSingletonQuery(sql, parameters)

Returns an object containing values for the selected database values. All property names are lowercase.
Parameters

sql

string

Sql statement to be executed

parameters

object

Parameter values for any parameter placeholders in the sql property

Run Sample

getInputControl(columnName)

Returns a jQuery wrapped set (array) containing the input control. Reference to the actual control input control can be got by accessing element 0 of the array
Parameters

columnName

string

Name of the column

	...
	var customerId = DbNetLink.components["dbnetedit1"].getInputControl("customerid").val()
	...

	...
	var customerId = DbNetLink.components["dbnetedit1"].getInputControl("customerid")[0].value
	...
               

initialize()

Initializes the control and returns the first page of data. The method should be called after all the properties have been assigned.

Run Sample

initializeInsert()

Initialises the edit control ready to insert a new record.

 

refreshListOptions(columnName, options)

Refreshes the items in the drop-down list  The drop-down list is identified by columnName. If options is specified then it can be either a JavaScript array or an SQL statement. If not specified the column lookup property is used to populate the list.
Parameters

columnName

string

Name of the column

options (optional)

array|string

Javascript array or SQL statement

Run Sample

selectRecord(primaryKey)

Selects the record uniquely identified by the supplied primary key object.
Parameters

primaryKey

object

Primary key column names and values

 

	<script>
	function selectCustomer(custID)
	{
		var pk = { CustomerID : custID}
	        dbnetedit1.selectRecord(pk);
	}

	</script>

setColumnExpressions(columnNames)

Specifies the columns that are selected from the table or view specified in the fromPart property
Parameters

columnNames

array of strings

or

multiple strings

List of column names

 

	<script>
	jQuery(document).ready( init )

	function init()
	{
		var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
		with (dbnetgrid1)
		{
			connectionString = "SamplesDatabase"
			fromPart = "Suppliers"
			setColumnExpressions("CompanyName","Address","City","Phone","Fax");
			setColumnLabels("Company Name","Addr","Town","Work Phone","Fax");
			initialize()
		}
	}

	</script>

Run Sample

setColumnLabels(columnLabels)

Specifies the labels for the columns specified in setColumnExpressions
Parameters

columnLabels

array of strings

or

multiple strings

List of labels

 

	<script>
	jQuery(document).ready( init )

	function init()
	{
		var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
		with (dbnetgrid1)
		{
			connectionString = "SamplesDatabase"
			fromPart = "Suppliers"
			setColumnExpressions("CompanyName","Address","City","Phone","Fax");
			setColumnLabels("Company Name","Addr","Town","Work Phone","Fax");
			initialize()
		}
	}

	</script>

Run Sample

setColumnProperty(columnName, propertyName, propertyValue)

Assigns a property value to the specified column (or columns)

Parameters

columnName

string|array of strings

Column name or array of column names

propertyName

string

Name of the column property

propertyValue

string, number or boolean

The property value

 

Setting an individual property for a single column

	<script>
	jQuery(document).ready( init )

	function init()
	{
		var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
		with (dbnetgrid1)
		{
			connectionString = "SamplesDatabase"
			fromPart = "Orders"

			setColumnExpressions("CustomerID","EmployeeID","OrderDate","ShipVia","ShipCountry");
      setColumnProperty("CustomerID","label", "Customer");
      setColumnProperty("CustomerID","lookup", "select customerid, companyname from customers");
      setColumnProperty("CustomerID","filter", true);
      setColumnProperty("EmployeeID","label", "Employee");
      setColumnProperty("EmployeeID","lookup", "select employeeid, lastname from employees");
      setColumnProperty("EmployeeID","filter", true);
      setColumnProperty("OrderDate","filter", true);
      setColumnProperty("ShipCountry","filter", true);
      setColumnProperty("ShipVia","lookup", "select shipperid, companyname from shippers");
      setColumnProperty("ShipVia","filter", true);
			initialize()
		}
	}

	</script>

Setting an individual property for a multiple columns

	<script>
	jQuery(document).ready( init )

	function init()
	{
		var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
		with (dbnetgrid1)
		{
			connectionString = "SamplesDatabase"
			fromPart = "Orders"

			setColumnExpressions("CustomerID","OrderID","OrderDate","Freight","RequiredDate");
      setColumnProperty(["OrderID","OrderDate","Freight"],"search",false)
			initialize()
		}
	}

	</script>

Run Sample

setColumnProperty(columnName, properties)

Assigns multiple property values to the specified column

Parameters

columnName

string|array of strings

Column name or array of column names

properties

object

Property names and values

 

Setting an multiple properties for a single column

	<script>
	jQuery(document).ready( init )

	function init()
	{
	
		var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
		with (dbnetgrid1)
		{
			connectionString = "SamplesDatabase"
			fromPart = "Orders"

			setColumnExpressions("CustomerID","EmployeeID","OrderDate","ShipVia","ShipCountry");
			setColumnProperty("CustomerID",{label : "Customer", lookupSearchMode : "SearchText", lookup : "select CustomerID, CompanyName from Customers" })

			initialize()
		}
	}

	</script>

Run Sample

setInputControlValue(columnName,value)

Assigns a value to an input field and triggers any associated events

Parameters

columnName

string

Column name of the input control

value

string

Value to be assigned to the input control

Run Sample

toolbarElement(id)

Gets a reference to the specified toolbar element.

Parameters

id

string

id can be quickSearch, search, deleteRow, insertRow or navigation

Run Sample