bootstrap-editable-rails icon indicating copy to clipboard operation
bootstrap-editable-rails copied to clipboard

Editable columns in table

Open burtondav opened this issue 13 years ago • 4 comments

I'm trying to use a table created with an index do. So the same column gets repeated in each row. The first row is editable, the rest aren't.

Is there a way for me to fix this?

UPDATE - I see this is the same as the other issue

burtondav avatar Jan 11 '13 01:01 burtondav

Would you show me the code (HTML) you wrote?

tkawa avatar Jan 11 '13 03:01 tkawa

Sure, I would appreciate the help!!

Cost Answers

Question Answer Contact Submit Date

This is the js.coffee

$(document).ready -> $(".costdetail_body").editable params: (params) -> params[$(this).data("resource") + "[id]"] = $(this).data("id") params

Thanks, David Burton

On Jan 10, 2013, at 8:45 PM, Toru KAWAMURA [email protected] wrote:

Would you show me the code (HTML) you wrote?

— Reply to this email directly or view it on GitHub.

burtondav avatar Jan 11 '13 03:01 burtondav

Since this seems not to be "nested attributes" according to data-url="/costdetails/<%= costdetail.id %> ", please do not use the method of #1. If it is "nested attributes", it should have written in this way.

class Costproject < ActiveRecord::Base
  accepts_nested_attributes_for :costdetails
end

tkawa avatar Jan 11 '13 04:01 tkawa

Toru, Thanks for the help!! I'm sorry to be a bother.

I have changed my costproject model to contain accepts_nested_attributes_for :cost details

Now, when I edit a column, it adds a new record instead of replacing the one I'm trying to edit.

David Burton

On Jan 10, 2013, at 9:16 PM, Toru KAWAMURA [email protected] wrote:

Since this is not "nested attributes" according to data-url="/costdetails/<%= costdetail.id %> ", please do not use the method of #1. If it is "nested attributes", it should have written in this way.

class Costproject < ActiveRecord::Base accepts_nested_attributes_for :costdetails end — Reply to this email directly or view it on GitHub.

burtondav avatar Jan 11 '13 15:01 burtondav