Skip to content

Instantly share code, notes, and snippets.

@yamaryu0508
Last active November 15, 2017 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamaryu0508/b08f9a18e2c69f619e90562b9e57b698 to your computer and use it in GitHub Desktop.
Save yamaryu0508/b08f9a18e2c69f619e90562b9e57b698 to your computer and use it in GitHub Desktop.
フィールドのラベルにスクリプトが仕込まれる
/*
* global.$
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
// フィールド情報からセレクトボックスを生成
var $select1 = $('<div class="kintoneplugin-select-outer"><div class="kintoneplugin-select"><select id="select1"></select></div></div>');
$(kintone.app.getHeaderMenuSpaceElement()).append($select1);
kintone.api(kintone.api.url('/k/v1/preview/app/form/fields', true), 'GET', {
app: kintone.app.getId()
}).then(function (r) {
var props = r.properties;
Object.keys(props).forEach(function(prop){
var field = props[prop];
$('#select1').append('<option value="' + field.label + '">' + field.label + ' [' + field.type + '/' + field.code + ']' + '</option>');
});
}).catch(function (e) {
console.log(e);
});
return event;
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment