Jump to content

Grid edit by default


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.

Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...
  • 1 year later...

@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>

Link to comment
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>

 

Link to comment
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>

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 6 months later...
  • 8 months later...
  • 8 months later...
  • 3 months later...
On 8/15/2016 at 12:08 PM, MayMusic said:

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.

When I insert this code, it defaults to grid edit but when I try to exit grid edit it won't let me. How can I fix this?

Link to comment
Share on other sites

1 hour ago, pmcfarlain said:

When I insert this code, it defaults to grid edit but when I try to exit grid edit it won't let me. How can I fix this?

Try this one, this will only run once, when the DataPage is loaded, after that, it will not run anymore unless you refresh

 

<script>

document.addEventListener("DataPageReady", function(e){

var gridEditButton = document.querySelector("a[data-cb-name='GridEditButton']");
   
gridEditButton.click();

});

</script>

This is much simpler method than the one above. That's to force Grid Edit. You don't need the other script for this, just the style, maybe

Link to comment
Share on other sites

On 6/17/2021 at 2:24 PM, TellMeWhy said:

Try this one, this will only run once, when the DataPage is loaded, after that, it will not run anymore unless you refresh

 


<script>

document.addEventListener("DataPageReady", function(e){

var gridEditButton = document.querySelector("a[data-cb-name='GridEditButton']");
   
gridEditButton.click();

});

</script>

This is much simpler method than the one above. That's to force Grid Edit. You don't need the other script for this, just the style, maybe

That works perfectly. Thank you!

Link to comment
Share on other sites

  • 1 year later...

This is a really useful thread.

I have a follow up question. I have used code given, and it switches to the Grid Edit automatically, as expected.

However, the user sees the regular tabular report first, before it switches to grid edit. Is there a way to set it so that they don't see this?

Then is it also possible to stop them switching away from the grid edit view?

Thanks!

Oliver

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...