Skip to content

Alter TD value and re-sort, doesn't work. #106

@marcreig

Description

@marcreig

Hi again. Last changes made my day. Them taken a long time, but already done! So thanks again.

Now about this feature:

  • I've a table, with normal TDs with some content on'em, text and numbers. Content is inside an <span>.
  • I've created a JS snipet which on TD-content click, it changes from span to input-text, and let's you alter the content. On blur then, it saves changes on DB, and comes back from input-text to span. Quite tipical nowadays.

Expecting a behaviour like the one exposed on info text:

When you add table rows or whole table from client side, use $.bootstrapSortable({ applyLast: true }) function to add sortability to parts/tables that were not present at document.ready. Use optional paramater applyLast=true if you want to preserve the last used sorting.

I've called the
$.bootstrapSortable({applyLast: true, sign: 'reversed'});

But nothing happens. Do not re-sorts the changed row.
So to solve this, I've basically added an snippet on my "from input-text to span" part, which changes the "data-value" from the span parent TD. And after that, I call the $.bootstrapSortable({applyLast: true, sign: 'reversed'}); and then it works.

$(this).parents('td').attr("data-value", $(this).val().toUpperCase()); //fill data-value to re-sort on change.

Question is: is this the normal behaviour? Or it is expected to re-map the TD "data-value" automatically when $.bootstrapSortable({applyLast: true, sign: 'reversed'}); is called?

Thanks and kind regards.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions