Solved

Javascript error in DBNETGRID

Posted on 2013-02-01
14
688 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

688 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