Master Posted August 15, 2016 Report Share Posted August 15, 2016 When I open my report I want Grid edit to be the same size as my report and also I want the report to be in Grid edit mode by default. Any ideas? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted August 15, 2016 Report Share Posted August 15, 2016 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. HeatherM and Lepidoptera 1 1 Quote Link to comment Share on other sites More sharing options...
telepet Posted April 13, 2017 Report Share Posted April 13, 2017 Is there a way to adjust individual column widths when in Grid Edit mode? Or, better yet, have Grid Edit mode columns automatically adjust to the width of the content? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 30, 2017 Report Share Posted June 30, 2017 You can try to change the style to: <style> .cbGridCtnr > .BodyCtnr > .Table{ width: auto; } .cbGridCtnr > .HeadCtnr > .Table { width: auto; } </style> telepet 1 Quote Link to comment Share on other sites More sharing options...
jasonkaeb Posted November 6, 2018 Report Share Posted November 6, 2018 @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? Quote Link to comment Share on other sites More sharing options...
Alison Posted November 6, 2018 Report Share Posted November 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
jasonkaeb Posted November 6, 2018 Report Share Posted November 6, 2018 @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> Quote Link to comment Share on other sites More sharing options...
Alison Posted November 6, 2018 Report Share Posted November 6, 2018 @jasonkaeb, have you switched to the Source mode or disable HTML editor on the Advanced tab? Quote Link to comment Share on other sites More sharing options...
jasonkaeb Posted November 6, 2018 Report Share Posted November 6, 2018 @Alison Yes, I have done that. Quote Link to comment Share on other sites More sharing options...
Alison Posted November 7, 2018 Report Share Posted November 7, 2018 @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> Quote Link to comment Share on other sites More sharing options...
jasonkaeb Posted November 7, 2018 Report Share Posted November 7, 2018 @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> Quote Link to comment Share on other sites More sharing options...
Alison Posted November 8, 2018 Report Share Posted November 8, 2018 @jasonkaeb It works perfectly on my end. Could you provide me with the link to the page, please? Quote Link to comment Share on other sites More sharing options...
jasonkaeb Posted November 8, 2018 Report Share Posted November 8, 2018 @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! Quote Link to comment Share on other sites More sharing options...
Alison Posted November 8, 2018 Report Share Posted November 8, 2018 @jasonkaeb You are welcome! I was glad to help you. jasonkaeb 1 Quote Link to comment Share on other sites More sharing options...
MayMusic Posted November 8, 2018 Report Share Posted November 8, 2018 Then my code is not working with freezed header right? Quote Link to comment Share on other sites More sharing options...
jasonkaeb Posted November 8, 2018 Report Share Posted November 8, 2018 @MayMusic Yes, that is correct. Quote Link to comment Share on other sites More sharing options...
gsgriffin Posted February 12, 2019 Report Share Posted February 12, 2019 It will work with freezed header with this line changed: var gridEditButton = $("[data-cb-name='GridEditButton']")[2]; Freezing the headers creates an extra table just for the header. Just need to select the correct link to execute. ;) Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 22, 2019 Report Share Posted March 22, 2019 Thanks that worked for me as well Quote Link to comment Share on other sites More sharing options...
Fernanda Posted October 11, 2019 Report Share Posted October 11, 2019 Hi! I tried using the code to pre-load the edit-grid opened ( it works great!). However, I'm still having trouble with styling in grid edit mode. Is there a way to wrap the text in the columns in grid edit? My text is wrapped when I exit the edit mode Quote Link to comment Share on other sites More sharing options...
AtayBalunbalunan Posted June 21, 2020 Report Share Posted June 21, 2020 Have you tried this solution, Fernanda? Quote Link to comment Share on other sites More sharing options...
IamNatoyThatLovesYou Posted February 25, 2021 Report Share Posted February 25, 2021 Hello Everyone, Just to add to the information, you can also check this solution. Quote Link to comment Share on other sites More sharing options...
pmcfarlain Posted June 17, 2021 Report Share Posted June 17, 2021 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? Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted June 17, 2021 Report Share Posted June 17, 2021 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 pmcfarlain 1 Quote Link to comment Share on other sites More sharing options...
pmcfarlain Posted June 18, 2021 Report Share Posted June 18, 2021 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! Quote Link to comment Share on other sites More sharing options...
oliverk Posted January 27, 2023 Report Share Posted January 27, 2023 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.