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

Editable radiobuttons in table. #1502

Closed
Rsasbrink opened this issue Jan 26, 2018 · 3 comments
Closed

Editable radiobuttons in table. #1502

Rsasbrink opened this issue Jan 26, 2018 · 3 comments

Comments

@Rsasbrink
Copy link

Hi, I have a field with 3 radiobuttons in each row of my table which sets the status of that "appointment row". When I click it it puts a ajax call to my backend. However:
When I click on some of those radiobuttons to set some of those statuses it works and those statusses are getting updated in my backend space. But, when I select another sorting it sorts the table but RESETS those radiobuttons selected values to its original state. After a full refresh (which I don't want) I can see those new values and sort them.

image

@Mottie
Copy link
Owner

Mottie commented Jan 26, 2018

Hi @Rsasbrink!

It sounds like you need add a specific parser for that column... It doesn't have a radio parser included, but you should still load in the parser-input-select.js file to handle automatically updating the cache when the content changes. Then include the following parser, and set it in the appointment column:

HTML

<th class="sorter-radio">Appointment status</th>

Script

$.tablesorter.addParser({
  id: "radio",
  is: function() {
    return false;
  },
  format: function(txt, table, cell) {
    var $input = $(cell).find("input:checked");
    return $input.length ? $input.val() : txt;
  },
  parsed: true, // filter widget flag
  type: "text"
});

@Mottie
Copy link
Owner

Mottie commented Feb 2, 2018

The "radio" parser has been included in the parser-input-select.js file. Please let me know if you encounter any more issues.

@Mottie
Copy link
Owner

Mottie commented Feb 25, 2018

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Feb 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants