Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is embarassing. I can't figure out how to do something appearingly trivial.

tr.row(ng-repeat="user in users")
  td
    div(input-inline-edit="user.name" tabindex="{{ $index*10 + 1 }}")
  td
    div(input-inline-edit="user.surname" tabindex="{{ $index*10 + 2 }}")
  td
    div(tabindex="{{ $index*10 + 3 }}")

As I have rows, I need to be able to traverse the tabindex by row. Thus I thought best is to have the first row 1,2,3,4 the next 11,12,13,14 then 21,22,23,24

etc.

I am so embarassed I haven't been able to do this, the above code does not work, I tried

{{$index *10 + 1}}

or {{getIndex($index, 1)}}") with in the controller:

$scope.getIndex = function(index,i) {
      return index*10 + i;
    }

and countless other combinations...I can't believe I haven't achieved to do something seemingly simple

EDIT: OK, turns out I was greedy with info. I have an own directive for inline editing, "input-inline-edit". I have edited the code accordingly above. So if I have that directive, the tabindex does NOT work, but if I have a normal div (the third in the above example) it DOES!!! So for the first two I get tabindex=null, for the third I get a valid number. I am baffled.

share|improve this question
1  
THis is strange. I use tabindex="{{ $index*10 + 1 }}"> and works fine... –  Deividi Cavarzan Nov 14 '13 at 22:36
    
div's are tabbable? Can't focus a div –  charlietfl Nov 14 '13 at 22:40
    
@DeividiCavarzan you're right! I thought it wouldn't matter, but I have a custom directive. When I use that one, it doesn't work, otherwise it does –  fablife Nov 14 '13 at 23:01
    
@charlietfl I omitted my custom directive (see edits). The custom directive passes the tabindex on to an internal input element. –  fablife Nov 14 '13 at 23:02
    
ahhh fair enough...I should have gathered that from attribute input-inline-edit –  charlietfl Nov 14 '13 at 23:42
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.