Previously I have implemented inline editing with X-Editable and Bootstrap 3. With Bootstrap 4 it no longer seems to work. Check out the JsFiddle here.
If I define a simple popup like this:
<div style="margin: 150px">
<a href="#" class="comment" data-name="comment" data-type="text" data-pk="@item.Id" data-url="/" data-title="Enter comment">comment</a>
</div>
<script>
$(document).ready(function() {
$('.comment').editable();
});
</script>
It works fine in BS3 but as soon as I switch to BS4 it no longer works giving the error:
Uncaught TypeError: Cannot read property 'addClass' of undefined
at Popup.show (bootstrap-editable.js:1091)
at Editable.show (bootstrap-editable.js:1802)
at Editable.toggle (bootstrap-editable.js:1824)
at Editable.<anonymous> (bootstrap-editable.js:1547)
at HTMLAnchorElement.e (jquery-3.2.1.slim.min.js:2)
In the console.
What am I doing wrong? Should I be using a different library/fork?
Just to help anyone else who has this problem, here is how I dealt with it. I switched to inline mode:
$(document).ready(function() {
$('.comment').editable({
mode: 'inline',
});
$('.hours').editable({
mode: 'inline',
type: 'number',
step: '1.00',
min: '0.00',
max: '24'
});
});
This works OK but the buttons don't render any images due to glyphicons no longer being supported.
I added font-awesome and then used the following css to get the icons back:
.glyphicon-ok:before {
content: "\f00c";
}
.glyphicon-remove:before {
content: "\f00d";
}
.glyphicon {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
All seems to work as before. Thanks to Sadhu for pointing me in the right direction.