Last active
November 15, 2017 00:28
-
-
Save yamaryu0508/b08f9a18e2c69f619e90562b9e57b698 to your computer and use it in GitHub Desktop.
フィールドのラベルにスクリプトが仕込まれる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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