[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Javascript error in DBNETGRID

Posted on 2013-02-01
14
Medium Priority
?
703 Views
Last Modified: 2013-02-11
Hi,

I am not able to create a nested DBNetGrid due to javascript error.  Please see the code below:

function initialise(accessString)
{

setGridLooks(document.all.dbnetgrid1,accessString)
with (document.all.dbnetgrid1)
	{	
		fromPart = "[v_reporting_markit_cds_grouped]"
		orderColumn = "M_Z_DATE2"
		selectPart = ["ROLLUP_KEY", "M_Z_DATE2", "M_NB", "M_Z_SOURCEID", "M_Z_TRDNAME", "M_Z_TRDGRP", "M_CNT_USG", "M_TP_PFOLIO", "TransactionFlag", "UnderlyingTransactionFlag", "OriginalCounterpart", "FirstPaymentDate", "TradeDate", "EffectiveDate", "ScheduleTermDate", "UnderlyingScheduleTermDate", "M_TP_DSCTYPE", "M_INSTRUMENT", "RefObligation", "ReferenceEntityID", "M_Z_NOM1", "FixedRatePerAnnum", "M_Z_MV2", "M_Z_MV2_USD", "IntermediationBroker", "IntermediationBrokerCode", "M_Z_SPTCVPL", "M_Z_NOM1CUR", "M_DERIV_ACCRUED", "CleanMarketValue", "CleanMarketValueUSD", "CMA_ID", "Seniority", "M_Z_DATE2_RAW", "security_id", "MarkitRating", "M_TP_LENTDSP", "AlternativeSecRef", "USDIAAmount", "M_CCP", "M_USI", "TradeCount"];
		headings = ["ROLLUP_KEY", "M_Z_DATE2", "M_NB", "M_Z_SOURCEID", "M_Z_TRDNAME", "M_Z_TRDGRP", "M_CNT_USG", "M_TP_PFOLIO", "TransactionFlag", "UnderlyingTransactionFlag", "OriginalCounterpart", "FirstPaymentDate", "TradeDate", "EffectiveDate", "ScheduleTermDate", "UnderlyingScheduleTermDate", "M_TP_DSCTYPE", "M_INSTRUMENT", "RefObligation", "ReferenceEntityID", "M_Z_NOM1", "FixedRatePerAnnum", "M_Z_MV2", "M_Z_MV2_USD", "IntermediationBroker", "IntermediationBrokerCode", "M_Z_SPTCVPL", "M_Z_NOM1CUR", "M_DERIV_ACCRUED", "CleanMarketValue", "CleanMarketValueUSD", "CMA_ID", "Seniority", "M_Z_DATE2_RAW", "security_id", "MarkitRating", "M_TP_LENTDSP", "AlternativeSecRef", "USDIAAmount", "M_CCP", "M_USI", "TradeCount"];
		searchFields = ["M_Z_DATE2", "M_INSTRUMENT", "M_Z_TRDGRP", "M_CNT_USG", "M_CCP"];
		searchLabels = ["M_Z_DATE2", "M_INSTRUMENT", "M_Z_TRDGRP", "M_CNT_USG", "M_CCP"];
		
		/////////////////////////////////////////////////
		// set no text wrapping for all cells
		for (var i=0;i<selectPart.length;i++)
			setColumnProperty(selectPart[i],"noWrap:true");
		
		setColumnProperty("ROLLUP_KEY", "display", false)
		primaryKeyColumn = "ROLLUP_KEY"
		addNestedGrid(configureChildCDs, 'ROLLUP_KEY')
    }	
}

function configureChildCDs(parentGrid){
	with (parentGrid.childGrid)
	{	

		fromPart = "[v_reporting_markit_cds_details]"
		headings = ["ROLLUP_KEY", "ROLLUP_M_USI", "M_Z_DATE2", "M_NB", "M_Z_SOURCEID", "M_Z_TRDNAME", "M_Z_TRDGRP", "M_CNT_USG", "M_TP_PFOLIO", "TransactionFlag", "UnderlyingTransactionFlag", "OriginalCounterpart", "FirstPaymentDate", "TradeDate", "EffectiveDate", "ScheduleTermDate", "UnderlyingScheduleTermDate", "M_TP_DSCTYPE", "M_INSTRUMENT", "RefObligation", "ReferenceEntityID", "M_Z_NOM1", "FixedRatePerAnnum", "M_Z_MV2", "M_Z_MV2_USD", "IntermediationBroker", "IntermediationBrokerCode", "M_Z_SPTCVPL", "M_Z_NOM1CUR", "M_DERIV_ACCRUED", "CleanMarketValue", "CleanMarketValueUSD", "CMA_ID", "Seniority", "M_Z_DATE2_RAW", "security_id", "MarkitRating", "M_TP_LENTDSP", "AlternativeSecRef", "USDIAAmount", "M_CCP", "M_USI",];
		selectPart = ["ROLLUP_KEY", "ROLLUP_M_USI", "M_Z_DATE2", "M_NB", "M_Z_SOURCEID", "M_Z_TRDNAME", "M_Z_TRDGRP", "M_CNT_USG", "M_TP_PFOLIO", "TransactionFlag", "UnderlyingTransactionFlag", "OriginalCounterpart", "FirstPaymentDate", "TradeDate", "EffectiveDate", "ScheduleTermDate", "UnderlyingScheduleTermDate", "M_TP_DSCTYPE", "M_INSTRUMENT", "RefObligation", "ReferenceEntityID", "M_Z_NOM1", "FixedRatePerAnnum", "M_Z_MV2", "M_Z_MV2_USD", "IntermediationBroker", "IntermediationBrokerCode", "M_Z_SPTCVPL", "M_Z_NOM1CUR", "M_DERIV_ACCRUED", "CleanMarketValue", "CleanMarketValueUSD", "CMA_ID", "Seniority", "M_Z_DATE2_RAW", "security_id", "MarkitRating", "M_TP_LENTDSP", "AlternativeSecRef", "USDIAAmount", "M_CCP", "M_USI",];
		displayToolbar = false	
		
		/////////////////////////////////////////////////
		// set no text wrapping for all cells
		for (var i=0;i<selectPart.length;i++)
			setColumnProperty(selectPart[i],"noWrap:true");
		//loadData()
	}
}

Open in new window


The parent results show fine, but the child function does not work.  When I click on "+" sign in the parent grid, I get a javascript error

Object Required
Line 27 - which is where I have
 with (parentGrid.childGrid)

Open in new window

specified.  If I change that to just be parentGrid, I don't get a javascript error when I click on a plus but it does not return me any data for the nested grid.
0
Comment
Question by:devbackoffice
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
14 Comments
 
LVL 29

Expert Comment

by:fibo
ID: 38846247
Seems the ParentGrid has no child.
1 - You might test for presence of childhood before "with-ing" it
2 -I don't know dbNetGrid. Is it supposed to define childhood? The code listed here does not seem to do
0
 

Author Comment

by:devbackoffice
ID: 38851259
No, this should work as is.  I verified this from multiple websites.
0
 
LVL 29

Expert Comment

by:fibo
ID: 38851589
I presume you have checked that the value of accessString when initializing is correct and as expected?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:devbackoffice
ID: 38851646
I verified and it is defined. I changed the code as follows:

function configureChildCDs(parentGrid){
	with (parentGrid.childGrid)
	{	
		DBMSName = "Microsoft SQL Server"
		connectionString = "MurexDwSqlDev.MurexProd_DevOpen"
		fromPart = "[v_reporting_markit_cds_details]"
		headings = ["ROLLUP_KEY", "ROLLUP_M_USI", "M_Z_DATE2", "M_NB", "M_Z_SOURCEID", "M_Z_TRDNAME", "M_Z_TRDGRP", "M_CNT_USG", "M_TP_PFOLIO", "TransactionFlag", "UnderlyingTransactionFlag", "OriginalCounterpart", "FirstPaymentDate", "TradeDate", "EffectiveDate", "ScheduleTermDate", "UnderlyingScheduleTermDate", "M_TP_DSCTYPE", "M_INSTRUMENT", "RefObligation", "ReferenceEntityID", "M_Z_NOM1", "FixedRatePerAnnum", "M_Z_MV2", "M_Z_MV2_USD", "IntermediationBroker", "IntermediationBrokerCode", "M_Z_SPTCVPL", "M_Z_NOM1CUR", "M_DERIV_ACCRUED", "CleanMarketValue", "CleanMarketValueUSD", "CMA_ID", "Seniority", "M_Z_DATE2_RAW", "security_id", "MarkitRating", "M_TP_LENTDSP", "AlternativeSecRef", "USDIAAmount", "M_CCP", "M_USI",];
		selectPart = ["ROLLUP_KEY", "ROLLUP_M_USI", "M_Z_DATE2", "M_NB", "M_Z_SOURCEID", "M_Z_TRDNAME", "M_Z_TRDGRP", "M_CNT_USG", "M_TP_PFOLIO", "TransactionFlag", "UnderlyingTransactionFlag", "OriginalCounterpart", "FirstPaymentDate", "TradeDate", "EffectiveDate", "ScheduleTermDate", "UnderlyingScheduleTermDate", "M_TP_DSCTYPE", "M_INSTRUMENT", "RefObligation", "ReferenceEntityID", "M_Z_NOM1", "FixedRatePerAnnum", "M_Z_MV2", "M_Z_MV2_USD", "IntermediationBroker", "IntermediationBrokerCode", "M_Z_SPTCVPL", "M_Z_NOM1CUR", "M_DERIV_ACCRUED", "CleanMarketValue", "CleanMarketValueUSD", "CMA_ID", "Seniority", "M_Z_DATE2_RAW", "security_id", "MarkitRating", "M_TP_LENTDSP", "AlternativeSecRef", "USDIAAmount", "M_CCP", "M_USI",];
		displayToolbar = false	
		
		/////////////////////////////////////////////////
		// set no text wrapping for all cells
		for (var i=0;i<selectPart.length;i++)
			setColumnProperty(selectPart[i],"noWrap:true");
		//loadData()
	}

Open in new window

0
 

Author Comment

by:devbackoffice
ID: 38855668
I don't know if this helps, but I call the js from aspx page.  Here is how the last revision of the code looks like. I got rid of anything extra.

function initialise()
{
	with (dbnetgrid1)
	{	
		headings = ["ROLLUP KEY", "DATE"];
		selectPart = ["ROLLUP_KEY", "M_Z_DATE2"];
		fromPart = "[v_reporting_markit_cds_grouped]"
		primaryKeyColumn = "ROLLUP_KEY"
		connectionString = "MurexDwSqlDev.MurexProd_DevOpen"
		
		addNestedGrid(configureChildCDs, "ROLLUP_KEY")
		loadData()
    }	
}

function configureChildCDs( parentGrid )
{
	if (parentGrid.childGrid == null)
	{	
		alert("Child grid is not defined")
		return
	}
	with (parentGrid.childGrid)
	{	
		displayToolbar = false	
		fromPart = "[v_reporting_markit_cds_details]"
		headings = ["ROLLUP KEY", "DATE", "ID"];
		selectPart = ["ROLLUP_KEY", "M_Z_DATE2", "M_NB"];
		loadData()
	}
}

Open in new window


I always get "Child grid is not defined" alert that I set up.  Child seems to always be null for some reason.
0
 
LVL 29

Expert Comment

by:fibo
ID: 38856215
I presume the data for addNestedGrid comes from some sql query that you have defined before addNestedGrfid.

What happens if the query returns no data?
0
 

Author Comment

by:devbackoffice
ID: 38856376
This is a native method of DBNetGrid API
0
 
LVL 29

Expert Comment

by:fibo
ID: 38856777
1 - From what I read at page http://www.dbnetsuite.net/samples/DbNetGrid/NestedGrids.aspx I would bet that in your initial example it should be
function configureChildCDs(parentGrid){
	with (parentGrid)

Open in new window


2 - You say that in that case you get no value.
This might have 2 causes:
- your data query returns values but there is an error somewhere and nothing displays
- your data query returns no value and you have no error

Hence my previous question: are you sure your query returns records? Have you any way to run the query directly and check the result
(Afterthought: you have data in the base, right?)
0
 

Author Comment

by:devbackoffice
ID: 38856959
I tried this example where I replaced parentGrid.ChildGrid with just grid.  Now I don't get the error message but it seems that the retrieval never happens for the nested grid. I clicked on + but no results were displayed.  I also noticed that when I  do
displayToolbar = false

Open in new window

it is being ignored and I still see the toolbar.
0
 
LVL 29

Expert Comment

by:fibo
ID: 38858428
Sorry to insist: have you checked that you have data to display?
0
 

Accepted Solution

by:
devbackoffice earned 0 total points
ID: 38859798
Figured it out with my coworker's help. The version I am using is older version of DBNetGrid and needs to use different type of reference:

with (window.event.srcElement.childGrid)

Open in new window

0
 
LVL 29

Expert Comment

by:fibo
ID: 38859833
B-) You should now close the question, allocating points to yourself since you provided the solution.
(Do not delete / cancel the question, so that it and its answer stay in the database)
0
 

Author Comment

by:devbackoffice
ID: 38859837
Thanks for your sugestions.  I will now close the question.
0
 

Author Closing Comment

by:devbackoffice
ID: 38875419
Solution provided for version DBNetGrid 2.9
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question