Ask Your Question

Horizon - unable to update row using ajax in a table

asked 2014-04-22 11:37:45 -0500

updated 2014-04-23 01:49:30 -0500


I have the following class MyTable used as my index table in I have modified my code to explain what I want to achieve.


    class UpdateRow(tables.Row):
        ajax = True
        def get_data(self, request, myrow_id):
            LOG.debug(("Update Row Called", myrow_id))
            row_entry = # RETURN VALUE OF AN API CALL
            return row_entry

    class MyTable ( tables.DataTable):
    # some tables.column attributes
    class Meta:
        name = "mytable"
        verbose_name = _("My Table")
        row_class = UpdateRow
        table_actions = (CreateRow, DeleteRow)

When I load the page on the dashboard, I can see the index page getting loaded properly but I don't see get_data of the UpdateRow being called. Neither the values on the dashboard, nor the log files show any changes. I have imitated what instances panel do to AJAX call for individual row.

Wanted to know if I have missed a step or did something wrong. Any help would be great!

Note: HORIZON_CONFIG dictionary in has no entry for 'ajax_poll_interval' but it should take it as 2.5 seconds timeout for auto-refresh for default.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-06-28 03:00:48 -0500

Davgut gravatar image

Didn't you forget the status_columns attribute into the Meta class ?

class Meta:
  status_columns = ["status"]
edit flag offensive delete link more

answered 2014-04-23 09:57:04 -0500

jpichon gravatar image

If I recall correctly, what triggers a call for updating the row is the row status being in an "unknown state", see in :

var $rows_to_update = $('tr.status_unknown.ajax-update');

You can look at for more information on row status and for an example.

edit flag offensive delete link more


Thanks jpichon, I wanted to display the data sent from the neutron-server on the index table. Something like how get_ips are populated after a while, just that I intend to do it iteratively as long as the user is in that URL. Does it have to be loaded from a different template like get_ips do?

prasoontelang gravatar imageprasoontelang ( 2014-04-23 13:41:41 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-04-22 11:37:45 -0500

Seen: 633 times

Last updated: Apr 23 '14