Must just have missed something in the API docs

Must just have missed something in the API docs

rstudnerrstudner Posts: 21Questions: 10Answers: 0

So, i'm trying to do two things:

Based on some totally external action/selection, navigate a datatable to the correct PAGE that matches the selection (i'm using the jumpToData() plugin for that).

THEN, once i'm "there", highlighting the row -- this is where i'm stuck.

      var rowText = TextFinder(idFromThingInRow);
      var table = $("#sensors-table");
      table.find('tr').removeClass('selected');
      var sensorsTableApiObject = table.DataTable();
      sensorsTableApiObject.page.jumpToData( rowText, 0 );
      sensorsTableApiObject.rows().every(function() {
        var data = this.data();
        var columnOne = data[0];
        var rowSensorId = "" + $(columnOne).data('value');
        if (sensorId === rowSensorId) {
           so i'm here... how can I add the class selected to "this row" when I don't have a handle on "this row" hah.

        }
      });

Answers

  • rstudnerrstudner Posts: 21Questions: 10Answers: 0

    I've tried, in the every "loop" things like:
    this.row()
    this.index()
    this.row().node()
    this.row().index() appears to return the right "#" but i'm not sure if that is pure coincidence. And even with that index (2 in this case) not sure how to still "get the tr so I can apply a style to it"

  • rstudnerrstudner Posts: 21Questions: 10Answers: 0

    derr - solved.

    this.node(); for some reason despite the API doc happily and clearly telling me I was handed the row context, my 'toe in the water' convinced me otherwise and the great rabbit hole welcomed me inside of it :)

  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin
    edited May 2015

    Heh - good to hear you got it sorted out :-)

    Allan

This discussion has been closed.