Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap-switch plugin for x-editable #1157

Open
karmendra opened this issue Mar 8, 2020 · 1 comment
Open

bootstrap-switch plugin for x-editable #1157

karmendra opened this issue Mar 8, 2020 · 1 comment

Comments

@karmendra
Copy link

karmendra commented Mar 8, 2020

You can use this toggleswitch script with (image) or without (image) bootstrap-switch plugin:

.editable('show') is to make sure that the control is always shown
If bootstrap_switch: true make sure you include bootstrap-switch library (tested with v3.3.4)

html:

<span>Verified:</span>
    <span id="verified"
      data-type="toggleswitch"
      data-value="{'true'}">
</span>

script:

$('#verified').editable({
    mode: 'inline',
    showbuttons: false,
    onblur: 'ignore',
    pk: 2,
    url: '/post.php',
    title: 'Verified',

    // toggleswitch specific options
    onchange: 'submit',
    bootstrap_switch: true,
    bootstrap_switch_options: {
        onText: 'YES',
        offText: 'NO',
        onColor: 'success',
        offColor: 'danger',
        size:'mini',
        inverse: true
    },
}).editable('show');
@vitormicillo
Copy link

and my suggestion for the field in the database is tinyint (1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants