Jump to content

Recommended Posts

You can try the code below in the header of Configure Result Pages Fields screen:

 

<style>
.cbGridCtnr > .BodyCtnr > .Table{
width: 100%;
}
.cbGridCtnr > .HeadCtnr > .Table {
    width: 100%;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>

function openGridAutomatically(delay)
{
	setTimeout(
		function()
		{
			var gridEditButton = $("[data-cb-name='GridEditButton']")[1];
			if (gridEditButton)
				f_dispatchEvent(gridEditButton, "click");
		}, delay ? delay : 500);
}
function f_dispatchEvent(v_element, v_type){
 if(v_element.dispatchEvent) {
  //var v_e = new Event(v_type);
  var v_e = document.createEvent('MouseEvents');
  v_e.initEvent(v_type, true, true);
  v_element.dispatchEvent(v_e); //new Event(v_type, {"bubbles":true, "cancelable":true})
 } else if(v_element.fireEvent){
  v_element.fireEvent('on' + v_type);
 }
};
openGridAutomatically();
</script>

width: 100%; should be changed to the width you have for your for your report page.

Share this post


Link to post
Share on other sites

@MayMusic I have a scenario where I would like my reports page to default to grid edit, similar to what you are describing here. I have tried the code you gave me in the header of my results page but it does not seem to work. Do you know if this Javascript code that you provided here from 2016 should still work as is?

Share this post


Link to post
Share on other sites

Hi @jasonkaeb,

You should add Header and Footer elements on the Configure Result Pages Fields screen and put the styles into the header and scripts into the footer. Also, you should check Grid Edit option on the "Search and Report Wizard - Results Page Editing Options" screen.

Share this post


Link to post
Share on other sites

@Alison Thank you for your quick reply. I was doing that wrong, so thanks for pointing that out. It still does not seem to be working for me. Can you see something I have wrong below? 

I have added the following as a header: 

<style>
.cbGridCtnr > .BodyCtnr > .Table{
width: 100%;
}
.cbGridCtnr > .HeadCtnr > .Table {
    width: 100%;
}
</style>

-------------------------------------

And the following in the footer: 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

<script>
function openGridAutomatically(delay)
{
    setTimeout(
        function()
        {
            var gridEditButton = $("[data-cb-name='GridEditButton']")[1];
            if (gridEditButton)
                f_dispatchEvent(gridEditButton, "click");
        }, delay ? delay : 500);
}
function f_dispatchEvent(v_element, v_type){
 if(v_element.dispatchEvent) {
  //var v_e = new Event(v_type);
  var v_e = document.createEvent('MouseEvents');
  v_e.initEvent(v_type, true, true);
  v_element.dispatchEvent(v_e); //new Event(v_type, {"bubbles":true, "cancelable":true})
 } else if(v_element.fireEvent){
  v_element.fireEvent('on' + v_type);
 }
};
openGridAutomatically();
</script>

------------------------------

I did notice on my page that the following script is showing in plain text on my page, which means this is not working correctly: 

< script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

Share this post


Link to post
Share on other sites

@jasonkaeb,  there might be something with the encoding in this line <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

Please copy the code below and paste it to the footer:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>

function openGridAutomatically(delay)
{
	setTimeout(
		function()
		{
			var gridEditButton = $("[data-cb-name='GridEditButton']")[1];
			if (gridEditButton)
				f_dispatchEvent(gridEditButton, "click");
		}, delay ? delay : 500);
}
function f_dispatchEvent(v_element, v_type){
 if(v_element.dispatchEvent) {
  //var v_e = new Event(v_type);
  var v_e = document.createEvent('MouseEvents');
  v_e.initEvent(v_type, true, true);
  v_element.dispatchEvent(v_e); //new Event(v_type, {"bubbles":true, "cancelable":true})
 } else if(v_element.fireEvent){
  v_element.fireEvent('on' + v_type);
 }
};
openGridAutomatically();
</script>

 

Share this post


Link to post
Share on other sites

@Alison Thanks for your reply. I did copy the code exactly as you have it and pasted it in the footer. The report opens correctly, but still does not open with the gred edit open. I still have the following code in the header: 


<style>
.cbGridCtnr > .BodyCtnr > .Table{
width: 100%;
}
.cbGridCtnr > .HeadCtnr > .Table {
    width: 100%;
}
</style>

Share this post


Link to post
Share on other sites

@Alison Since you said it worked for you I tried a couple more things on my end. I figured out that my issue was that I had Enable sticky header row enabled. Once I disabled this it worked perfectly. Thanks so much for your help! 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×