Hi there :)
I am biding my accordion to my view model and can't figure out why my sortable is no longer working?
I can get the demo working fine, once I bind it to my view model is where the problem starts.
Any ideas and help will be greatly appreciated!
- $(document).ready(function () {
- var stop = false;
- $("#accordion").click(function (event) {
- if (stop) {
- event.stopImmediatePropagation();
- event.preventDefault();
- stop = false;
- }
- });
- $("#accordion")
- .accordion({
- header: "> div > h3",
- active: false,
- collapsible: true,
- dropOnEmpty: true
- })
- .sortable({
- axis: "y",
- handle: " h3",
- stop: function (event, ui) {
- stop = true;
- },
- update: function (event, ui) {
- var params = $(this).sortable('serialize');
- }
- }
- );
- });
- <div>
- <div id="accordion">
- <div>
- @foreach (var item in Model)
- {
- <h3>
- <a href="#">@item.ServiceAreaRatingname</a>
- </h3>
- <div>
- <table class="width100pc">
-
- <tr>
- <td class="bgWidth100px">
- ID
- </td>
- <td>
- @item.ServiceAreaRatingId
- </td>
- </tr>
- <tr>
- <td class="bgWidth100px">
- Active
- </td>
- <td>
- @item.Active
- </td>
- </tr>
- </table>
- </div>
- }
- </div>
- </div>
- </div>