Avatar

Invoke window.open to open the details page, table records are rendered slowly.

Linner
Invoke window.open to open the details page, table records are rendered slowly. Referred code: 

(function() {

    "use strict";

    kintone.events.on('app.record.index.show', function(event) {

    var myIndexButton = document.createElement('button');

    myIndexButton.id = 'my_index_button';

    myIndexButton.innerText = 'Open Window';

    kintone.app.getHeaderMenuSpaceElement().appendChild(myIndexButton);

    myIndexButton.addEventListener("click", function(event){

    if(event.ctrlKey){

       window.open("https://{subdomain}.cybozu.com/k/9334/show#record=5&l.view=20&l.q&l.next=4&l.prev=6","_blank");
    }
    });
    });
})();

The bug occurs in Chrome: 85.0.4183.26 and Microsoft Edge 84.0.522.40
Follow 4 followers
0

7 comments

Avatar
Sean Tachibana 0 votes

Hello Linner,

 

Could you kindly check the details of the events that are occurring?

・What exactly is the situation with the rendering slowly?
 (e.g., it takes about 10 seconds to display a table.)

・How much information is entered into the table where the event occurs?

・The records being displayed have no JS processing in them.

 

Thanks,
Sean

0
Comment actions Permalink
Avatar
Linner 0 votes

Sean,

Compare to open details page by click the icon "Show the record details" in row header, it is much slower to invoke the script to open details page. 

window.open("https://{subdomain}.cybozu.com/k/9334/show#record=5&l.view=20&l.q&l.next=4&l.prev=6","_blank");

If a table has 3 items, to open it by click icon, the table shows immediately when the details page shows. But if you invoke the code, you will find the 3 items show one by one, it takes about 4 seconds to show the 3 items.

You please attach the scritps I post in any app that has table, then use Ctrl+click to click the button, you can reproduce the bug.

0
Comment actions Permalink
Avatar
Genji 0 votes
Hello Linner,

I have gone ahead and replaced your subdomain with `{subdomain}` for security and privacy purposes.

Thank you for your understanding,
Kintone Developer Program Team
0
Comment actions Permalink
Avatar
John Snow 0 votes

Hey Linner,

The following code worked fine on my end:

(function () {
  "use strict";
  kintone.events.on('app.record.index.show', function (event) {
    var myIndexButton = document.createElement('button');
    myIndexButton.id = 'my_index_button';
    myIndexButton.innerText = 'Open Window';
    kintone.app.getHeaderMenuSpaceElement().appendChild(myIndexButton);
    myIndexButton.addEventListener("click", function (event) {
      window.open("https://{SUBDOMAIN}.kintone.com/k/{APP_ID}/show#record={RECORD_ID}", "_blank");
    });
  });
})();
 
May I ask why you have set the `window.open(...)` code to only work when the CTR button is pressed?
I was unable to click the button itself since the CTR button triggers a Left Click for me.
 
As for the speed and overall performance of opening multiple records in your Kintone App, perhaps the query you are running to generate the record specific URLs is the culprit?
0
Comment actions Permalink
Avatar
Linner 0 votes

Hello John,
>May I ask why you have set the `window.open(...)` code to only work when the CTR button is pressed?
Out business logic need to hold ctrl then left click on the button.
With the code you pasted, the bug won't occur, you are right. But if you hold ctrl key to click on the button, you can reproduce the bug.
>perhaps the query you are running to generate the record specific URLs is the culprit?
No matter you hold ctrl or not, the queries are same.
>I was unable to click the button itself since the CTR button triggers a Left Click for me.
What do your mean? Could you please provide us a solution to solve the problem?

0
Comment actions Permalink
Avatar
Sean Tachibana 0 votes

Hello Linner, 

 

This is not a bug in kintone but instead is caused by a spec behavior on the browser side.

 

It reproduces in Chrome, but in Edge, the event did not occur.
Simply pressing the target URL while holding down ctrl did not seem to cause the event.

 

Therefore, I think this is caused by the processing of windows.open in Chrome while holding down ctrl.

 

As for the cause of this problem, it's unknown, but it may be possible to find out if you have the specs of the Chrome side checked.
Perhaps the DOM display method is different.

 

Also, when I used another function, location.replace, the screen transition was normal with or without ctrl-press, so maybe try using different processing.

 

I'm not quite sure why it is necessary to press ctrl to process it, could you process without pressing it?

 

Thanks,
Sean
0
Comment actions Permalink
Avatar
Linner 0 votes

Sean,

Thanks for your help. We will try to use other function.

>I'm not quite sure why it is necessary to press ctrl to process it, could you process without pressing it?

Holding down ctrl will open the url in new tab page.

Thanks,

Linner

0
Comment actions Permalink