javascript - Checkboxes checked by default -


i'm using checkboxgroupinput in field many checkboxes, , i'd them checked default.

i tried using options attribute this:

<checkboxgroupinput source="foo" choices={[   { id: 0, name: 'bar' },   { id: 1, name: 'bar' } ]} options={{   checked: true }}/> 

but no luck, checkboxes checked default, not usable: can't unchecked nor sent in post/put request.

thanks!

ps: check all button nice, if has implemented 1 i'd happy see how done.

you should use defaultvalue on form including input.

about check all button, can implemented in custom input. might copy/paste code of checkboxgroupinput , implement logic in it.

about converting values numbers, use normalize prop:

<checkboxgroupinput     normalize={value => value.map(v => parseint(v, 10))}     source="notifications"     choices={[         { id: 12, name: 'ray hakt' },         { id: 31, name: 'ann gullar' },         { id: 42, name: 'sean phonee' },     ]} /> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -