This is a migrated thread and some comments may be shown as answers.

New method chaining

2 Answers 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 15 May 2012, 07:24 PM
Reference Url

$("#grid").kendoGrid();
$("#grid").data("kendoGrid").refresh();

All of this ceremony caused frustration and so we decided to eliminate it by supporting method chaining. With this latest service pack, you'll be able to write JavaScript that's more readable:

$("grid").kendoGrid("refresh");

------------------------------------------
So what's the deal here?  We're to pass in method names as a string?  Cant just do...?
$("#grid").kendoGrid().refresh();

2 Answers, 1 is accepted

Sort by
0
Dr.YSG
Top achievements
Rank 2
answered on 16 May 2012, 03:17 PM
I was about to post the same question.

1. Does chaining mean that I get a result from the constructor that I can chain methods to (ala JQuery?)
var myGrid = $("#grid").kendoGrid();
And this seems to be a different pattern for method invocation, does it allow parameters? what is the philosophy here?  
$("grid").kendoGrid("refresh");
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 16 May 2012, 04:24 PM
@Doc,
  Here's a fiddle to play with...

http://jsfiddle.net/stevescotthome/mf9ED/6/

Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Dr.YSG
Top achievements
Rank 2
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or