4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【kintone】カスタマイズビューのHTML文字数上限を超える

Last updated at Posted at 2018-04-04

この記事は移行しました!最新の内容はこちらをご覧ください😀

HTMLは10,000文字以下という制約に引っかかってしまったときの解決法。

HTMLをjsの変数として定義して埋め込みましょう。

HTMLは空タグのみ用意

埋め込み先として空のdivタグのみ記述します。

一覧のカスタマイズHTML
<div id="customize_view"></div>

実際に表示したいHTMLをjsファイルに定義

テンプレートリテラル(バッククォートで囲む)を使えば改行のまま定義できて便利。

customize_view_template.js
const customize_view_template = `
{ここに10,000文字を超えるHTMLを書く}
`;

jsで表示する

最後に定義したHTMLをjsで出力します。

customize_view_logic.js
(function() {
    "use strict";

    const customize_view_id = 'customize_view';

    kintone.events.on(['app.record.index.show'], function (event) {
        // 対象のビューでない場合は処理しない
        if (document.getElementById(customize_view_id) == null) {
            return event;
        }

        // 出力
        document.getElementById(customize_view_id).insertAdjacentHTML('afterbegin', customize_view_template);

    });
})();
4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?