4 responses

  1. Vinny Brown
    February 7, 2014

    I’m not a Kendo user, but along the lines of what Mark Rendle suggested, It looks like we need to do something like:

    var target = this.target();
    if(target){
    return $(target).getDataItem();
    }else{ return null; }

    where the specifics of how to do that would be encapsulated in getDataItem() and have a lot more null-reference checking than we have in the sample :)

  2. Mark Rendle
    February 7, 2014

    They’re all pretty bad.

    I’d be looking to wrap it all in a jQuery extension/plug-in so I could just call:

    this.closestKendoDataItem();

    • Mark Rendle
      February 7, 2014

      Or, y’know, this.getDataItem();

  3. Leo
    February 7, 2014

    To me, 2 is the easier to read. To read 3 you have to keep in memory the lines to fully understand what is happening.
    And since we are talking about javascript, the less code, the better (I know this would eventually be minified but we still save some bytes with 1 or 2).

Leave a Reply

 

 

 

Back to top
mobile desktop