Pergunta

I have implemented a right click popup menu on my KendoUI Grid.

The problem is, is that it is slow.

When you right click the script needs to get the id of the row which was clicked. I am doing this with:

salesGrid.on('mouseup', '[role="row"]', function(e){
  button = e.which ;
  if(button == 3)
  {
    $(this).bind("contextmenu",function(e){
      return false
    });

    var id = null ;
    id = $('td', this).find('.id-span').data('id') // ~500ms

I have also tried:

id = $(this).children('td').children('.id-span').data('id') ;

And:

id = $('td:first span', this).data('id') ;

All of which take about 500ms to execute, which is too long in terms of user experience.

Here is the table it is traversing:

<tr data-uid="16e14dc2-a2fa-4979-a1ff-cd5113223aa6" role="row">
    <td role="gridcell"><span class="id-span" data-id="1">A</span></td>
    <td role="gridcell">3</td>
    <td role="gridcell">Lenze</td>
    <td role="gridcell"><span class="popoverintel" data-trigger="hover" data-placement="bottom" data-part-id="1">33.8202-E</span></td>
    <td role="gridcell">Supply</td>
    <td role="gridcell">New</td>
    <td role="gridcell">3</td>
    <td role="gridcell">€</td>
    <td role="gridcell">575.00</td>
    <td role="gridcell">1725.00</td>
</tr>

Is there a way to make this faster?

Foi útil?

Solução

Try changing the selector '[role="row"]' by 'tr[role="row"]'

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top