Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7022265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:33:33+00:00 2026-05-27T23:33:33+00:00

I have a container td element that I populate successfuly with other elements using

  • 0

I have a container td element that I populate successfuly with other elements using an HTML partial, it’s done when the page loads.

The partial runs over a task object that it gets as a param and desides which elements to add.

After a specific action is done the task object is updated and I want to update the container by running the partial again.

I’m calling this partial from my create.js.haml with the updated task, the partial runs and builds the correct updated HTML (I can see it in the Firebug response).

But the actual page doesn’t update. What am I missing here?

Here are my files:

html.haml that holds the container td:

%td#task-categories{ :class => "#{dom_id(task)}_categories"}
  = render 'task_categories_mini_bar', :task => task

The partial html.haml:

- _MAX_DISPLAYED_CAT = 3
- cat_index = 0
- task.categories.each do |category|
  - if (cat_index == _MAX_DISPLAYED_CAT)
    %td{:style => "padding-left:1px; padding-right:5px"} ...
    - break
  - cat_index += 1
  %td{ :class => "task-category-color_#{dom_id(category)}",
  :style => "width:60px; background:#{category.color}; border:solid 1pt lightblue; border-radius:3pt; text-align:center; "}
    = truncate(category.name, :length => 10)

Combined together they build this HTML:

<td id="task-categories" class="task_3_categories"> </td>
<td class="task-category-color_category_1" style="width:60px; background:#b8d7ff; border:solid 1pt lightblue; border-radius:3pt; text-align:center; "> cat1 </td>
<td class="task-category-color_category_2" style="width:60px; background:#ff8fcb; border:solid 1pt lightblue; border-radius:3pt; text-align:center; "> cat2 </td>

There’s another problem here – the two added category tds are added below the first container td. How can I add them to it and not after it?

Now here is the create.js.haml that calls the partial again:

$('td.#{dom_id(@task)}_categories').html(#{escape_javascript(render(:partial => 'tasks/task_categories_mini_bar', :locals => {:task => @task}))})

Again the response HTML does displays a new HTML but the page doesn’t update.

I’m using rails 3.0.10 Thanks allot, Eyal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:33:34+00:00Added an answer on May 27, 2026 at 11:33 pm

    OK then, what I was missing was ” ” around the call for the partial in my ajax create.js.haml

    $('td.#{dom_id(@task)}_categories').html("#{escape_javascript(render(:partial => 'tasks/task_categories_mini_bar', :locals => {:task => @task}))}")
    

    Thats all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container element that you can drag objects around in. I want
Suppose I have an element called #container-main . How do I make that display:none
I have a page that contains an element, <displayedimage> , that is not getting
I have a select element that is in the DOM from page load. Lets
I have a form element that contains multiple lines of inputs. Think of each
I have two STL containers that I want to merge, removing any elements that
I have a div element that has an id and this div contains a
I have an xml file that contains its element like <ab:test>Str</ab:test> When I am
I have a rather large list of data that contains 5 properties per element.
I have a numeric vector, it contains patches of elements that are repeating, something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.