angular-data-table icon indicating copy to clipboard operation
angular-data-table copied to clipboard

Link inside row

Open maxtechera opened this issue 9 years ago • 6 comments

Cant navigate clicking a link inside the rows. Placing a "A" tag with either href or s-ref leads to the same result.

Also, if you click inside the table, hitting F5 to refresh doesnt work.

It looks like its preventing or something like that.

maxtechera avatar Aug 03 '15 17:08 maxtechera

Can you provide a demo?

amcdnl avatar Aug 07 '15 17:08 amcdnl

You can see it in the basic demo at http://swimlane.github.io/angular-data-table/

Click on a table row then hit F5 or F12 to open devtools (chrome), it wont work click outside the table makes it work again.

My workaround for the link was using a funcion with on-row-click, is there any way to get the click event ?

EDIT: Keyboard inputs is fixed by removing ev.preventDefault() in the keydown function.

function keyDown(ev, index, row) {
        ev.preventDefault();

        if (ev.keyCode === KEYS.DOWN) {
          var next = ev.target.nextElementSibling;
          if (next) {
            next.focus();
          }
        } else if (ev.keyCode === KEYS.UP) {
          var prev = ev.target.previousElementSibling;
          if (prev) {
            prev.focus();
          }
        } else if (ev.keyCode === KEYS.RETURN) {
          this.selectRow(index, row);
        }
      }
}

And I think the same is happening with the click for links, you are preventing default before checking if its selectable. Maybe move this prevent to the function "selectRow" method after checking "this.options.selectable".

function rowClicked(event, index, row) {
        if (!this.options.checkboxSelection) {
          event.preventDefault();
          this.selectRow(index, row);
        }

        this.$scope.onRowClick({ row: row});
      }

maxtechera avatar Aug 12 '15 18:08 maxtechera

any updates on this bug?

I have the following rendering function and doesn't work

columns: [{
    name: 'A column',
    cellRenderer: () => '<a ui-sref="someController({someParam: {{$cell}}})">{{$cell}}</a>'}]

lnramirez avatar Jun 10 '16 21:06 lnramirez

@lnramirez sorry haven't had time to dive in, if you wanna do a PR and ensure the other scenarios still work, I'll happily accept.

I use the row click event myself for this so have no had this problem.

amcdnl avatar Jun 10 '16 21:06 amcdnl

@amcdnl a coworker suggested to add checkbox options and links started working without having to add a row click listener

this.options = {
checkboxSelection: true,
columns: [{
          name: 'A column',
          cellRenderer: () => '<a ui-sref="someController({someParam: {{$cell}}})">{{$cell}}</a>
          }] }

lnramirez avatar Jun 13 '16 18:06 lnramirez

Haha, thats silly.

amcdnl avatar Jun 13 '16 20:06 amcdnl