cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the Display Template and Query Template of an existing iGrid

Former Member
0 Kudos

The following code is not working as expected. The Display template does update but the data from the query is not returned. Of course, I have tried to plug in default parameters, but if I try to change the Display Template or Query Template it fails to run after passing the setParams. Your help is appreciated.


function jsChangeGrid(var1, var2) {
	// Attach to the applet at the DOM
	var domGrid = document.iGrid
	// Attach to the grid object
	var objGrid = domGrid.getGridObject();
	// Attach to the query object
	var queryObj = domGrid.getQueryObject();

	// Set query template
	domGrid.setQueryTemplate('Queries/queryTemplate');
	
	// Set display template
        domGrid.setDisplayTemplate('Data/displayTemplate');
	
	// Set the query parameters for the grid object
	queryObj.setParam(1,var1);
	queryObj.setParam(2,var2r);

        // Update the iGrid
	domGrid.updateGrid(true);
}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Chris

I have gone through the code and found that its logically makes sense, but I wod like to suggest you some changes to the same which I feel is syntactically incorrect :-

1. var domGrid = document.iGrid; ---> insert a semicolon there n the part iGrid must be the name of the Applet.

2. Please check for the path as you have passed them as the parameters to the setQueryTemplate() and setDisplayTemplate().

3. I am not sure about the suggestion below but I feel that you can create the variable queryObj after you set the Query Template to a new Query Template.

i mean this order may work :-

domGrid.setQueryTemplate('Queries/queryTemplate');

var queryObj = domGrid.getQueryObject();

queryObj.setParam(1,var1);

queryObj.setParam(2,var2r); -


> remove var2r with var2 if i m not wrong.

Thanks

Amit Rath