Include the client JavaScript & CSS libraries
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
Client-side configuration script
<script>
jQuery(document).ready( init )
function init()
{
var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
with (dbnetgrid1)
{
connectionString = "SamplesDatabase"
fromPart = "products"
userProfile = true
userProfileSelect = true
columnPicker = true
sort = true
quickSearch = true
toolButtonText("sort","Sort");
toolButtonText("userProfile","Save/Restore");
setColumnProperty("CategoryId","lookup","select CategoryId, CategoryName from Categories");
setColumnProperty("SupplierID","lookup","select SupplierID, CompanyName from Suppliers");
setColumnExpressions("ProductID","ProductName","SupplierID","CategoryID","Discontinued","(0) as action")
bind("onInitialized",selectProfile)
searchFilterSql = "1=2"
initialize()
}
}
function selectProfile(sender) {
var profileText = "Start"
var profileSelect = jQuery(sender.toolbarElement("userProfileSelect"));
profileSelect.find("option:contains('" + profileText + "')").attr("selected","true");
if ( profileSelect.val() != "" )
profileSelect.trigger("change");
}
</script>
HTML markup
<div id="dbnetgrid1"></div>