<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:georss="http://www.georss.org/georss" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
  <channel>
    <title>Nesterovsky bros - kendoui</title>
    <link>http://www.nesterovsky-bros.com/weblog/</link>
    <description />
    <language>en-us</language>
    <copyright>Nesterovsky bros</copyright>
    <lastBuildDate>Wed, 18 Mar 2015 14:16:25 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.12105.0</generator>
    <managingEditor>contact@nesterovsky-bros.com</managingEditor>
    <webMaster>contact@nesterovsky-bros.com</webMaster>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=d8df53fa-9f5e-40f5-9a07-77193e05e6c7</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,d8df53fa-9f5e-40f5-9a07-77193e05e6c7.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:comment>http://www.nesterovsky-bros.com/weblog/CommentView,guid,d8df53fa-9f5e-40f5-9a07-77193e05e6c7.aspx</wfw:comment>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=d8df53fa-9f5e-40f5-9a07-77193e05e6c7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Two years ago, when we were still actively using <a href="http://www.telerik.com/kendo-ui">KendoUI</a> we
had published our approach on how to introduce custom widgets, which we called <a href="http://www.nesterovsky-bros.com/weblog/2013/03/26/KendoUIUserControl.aspx">User
Controls</a>.
</p>
        <p>
We even suggested <a href="http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/3998013-to-introduce-usercontrol-widget">to
introduce UserControl widget</a> into KendoUI core through feedback page. At that
time we got a response from KendoUI team:
</p>
        <blockquote style="font-style: italic"> Our recommended approach for building reusable
app building blocks is expressed via the Kendo UI SPA features delivered earlier this
year. Here’s a getting started resource if you’ve not already seen it: <a href="http://www.kendoui.com/blogs/teamblog/posts/13-05-16/kendo-ui-spa-screencast-and-getting-started.aspx">http://www.kendoui.com/blogs/teamblog/posts/13-05-16/kendo-ui-spa-screencast-and-getting-started.aspx</a></blockquote>
        <p>
It was not clear how the response is related to the suggestion, but we decided not
to rebuke the team, and to proceed with our user controls.
</p>
        <p>
Nowdays we use KendoUI no more, and have completely switched to <a href="https://angularjs.org/">angularjs</a>.
Ocasionally, however, we need to support old projects, and peek into docs. Today we've
discovered that the team has changed their mind, and allowed custom widgets: "<a href="http://docs.telerik.com/kendo-ui/framework/widgets/create-custom-kendo-widget">Create
Your Own Kendo UI Widget by Inheriting from the Base Widget Class</a>". That's
good news! 
</p>
        <p>
But the most interesting thing is that the design of their custom widget is very close
to what we have suggested then.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=d8df53fa-9f5e-40f5-9a07-77193e05e6c7" />
      </body>
      <title>KendoUI User Control</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,d8df53fa-9f5e-40f5-9a07-77193e05e6c7.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2015/03/18/KendoUIUserControl.aspx</link>
      <pubDate>Wed, 18 Mar 2015 14:16:25 GMT</pubDate>
      <description>  &lt;p&gt;
Two years ago, when we were still actively using &lt;a href="http://www.telerik.com/kendo-ui"&gt;KendoUI&lt;/a&gt; we
had published our approach on how to introduce custom widgets, which we called &lt;a href="http://www.nesterovsky-bros.com/weblog/2013/03/26/KendoUIUserControl.aspx"&gt;User
Controls&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
We even suggested &lt;a href="http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/3998013-to-introduce-usercontrol-widget"&gt;to
introduce UserControl widget&lt;/a&gt; into KendoUI core through feedback page. At that
time we got a response from KendoUI team:
&lt;/p&gt;
&lt;blockquote style="font-style: italic"&gt; Our recommended approach for building reusable
app building blocks is expressed via the Kendo UI SPA features delivered earlier this
year. Here’s a getting started resource if you’ve not already seen it: &lt;a href="http://www.kendoui.com/blogs/teamblog/posts/13-05-16/kendo-ui-spa-screencast-and-getting-started.aspx"&gt;http://www.kendoui.com/blogs/teamblog/posts/13-05-16/kendo-ui-spa-screencast-and-getting-started.aspx&lt;/a&gt;&lt;/blockquote&gt; 
&lt;p&gt;
It was not clear how the response is related to the suggestion, but we decided not
to rebuke the team, and to proceed with our user controls.
&lt;/p&gt;
&lt;p&gt;
Nowdays we use KendoUI no more, and have completely switched to &lt;a href="https://angularjs.org/"&gt;angularjs&lt;/a&gt;.
Ocasionally, however, we need to support old projects, and peek into docs. Today we've
discovered that the team has changed their mind, and allowed custom widgets: &amp;quot;&lt;a href="http://docs.telerik.com/kendo-ui/framework/widgets/create-custom-kendo-widget"&gt;Create
Your Own Kendo UI Widget by Inheriting from the Base Widget Class&lt;/a&gt;&amp;quot;. That&amp;#39;s
good news! 
&lt;/p&gt;
&lt;p&gt;
But the most interesting thing is that the design of their custom widget is very close
to what we have suggested then.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=d8df53fa-9f5e-40f5-9a07-77193e05e6c7" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,d8df53fa-9f5e-40f5-9a07-77193e05e6c7.aspx</comments>
      <category>AngularJS</category>
      <category>javascript</category>
      <category>kendoui</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=044c2188-ce3c-43a9-a7aa-0b98d88bb19f</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,044c2188-ce3c-43a9-a7aa-0b98d88bb19f.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:comment>http://www.nesterovsky-bros.com/weblog/CommentView,guid,044c2188-ce3c-43a9-a7aa-0b98d88bb19f.aspx</wfw:comment>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=044c2188-ce3c-43a9-a7aa-0b98d88bb19f</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
After several years of experience with <a href="http://www.telerik.com/kendo-ui">KendoUI</a> we
turned our attention to <a href="https://angularjs.org/">AngularJS</a>. As many other
libraries it has its strong and weak sides. There are many resources describing what
AngularJS is, and what it is not. Our approach to study AngularJS was through an attempt
to integrate it into an existing KendoUI web application. 
</p>
        <p>
It's rather straightforward to convert model from KendoUI into AngularJS, as logically
both frameworks are equal in this regard. But tactically KendoUI implements model-view
binding very differently than AngularJS does. KendoUI binds model to view immediately
per each model field, where AngularJS delays a binding of each model field and performs
whole model binding in one go. Angular's approach is more performant, and even
more appealing to a developer, though the problem is that the time it takes to make
whole model binding is proportional to a size (number of objects and properties) of
model. This means that if you have a relatively big model you will experience tangible
halts in browser's UI while a javascript updating view/model is running.
</p>
        <p>
AngularJS advices some workaround, which in essence is to avoid big model. The problem
is that a couple of thousands or even several hundrends of objects and properties
are already considered big model. So, you should immediately plan your model, and
view to avoid any potential impact. This seriously distracts from the task your're
solving.
</p>
        <p>
The idea that your UI will halt for the time proportional to the size of your whole
model looks flawed in our opinion. KendoUI knows no such a problem. That's the
reason why our KendoUI to AngularJS transition experience was not smooth.
</p>
        <p>
Our analysis of AngularJS sources shows that the issue could be resolved provided
model to view binding (it's called digest in that library) was asynchronous.
</p>
        <p>
To verify our ideas we have created a branch <a href="https://github.com/nesterovsky-bros/angular.js">nesterovsky-bros/angular.js</a> where
we implemented required refactorings. It includes: 
</p>
        <ul>
          <li>
API based on existing deferred/promise to write algorithms in async way, and 
</li>
          <li>
refactored digest logic.</li>
        </ul>
        <p>
At the end we have proposed to integrate our changes into the main branch: <a href="https://github.com/angular/angular.js/pull/7548">Make
$digest async</a>.
</p>
        <p>
We're not sure whether our proposition will be integrated (rather no than yes).
Nevertheless what we have come with is an interesting extension of deferred object
that we neither have seen in AngularJS nor in JQuery, so later we will quote that
API from <a href="https://github.com/nesterovsky-bros/angular.js/blob/master/src/ng/q.js">q.js</a> and <a href="https://github.com/nesterovsky-bros/angular.js/blob/master/src/ng/scheduler.js">scheduler.js</a>.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=044c2188-ce3c-43a9-a7aa-0b98d88bb19f" />
      </body>
      <title>AngularJS</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,044c2188-ce3c-43a9-a7aa-0b98d88bb19f.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2014/05/25/AngularJS.aspx</link>
      <pubDate>Sun, 25 May 2014 08:02:41 GMT</pubDate>
      <description>  &lt;p&gt;
After several years of experience with &lt;a href="http://www.telerik.com/kendo-ui"&gt;KendoUI&lt;/a&gt; we
turned our attention to &lt;a href="https://angularjs.org/"&gt;AngularJS&lt;/a&gt;. As many other
libraries it has its strong and weak sides. There are many resources describing what
AngularJS is, and what it is not. Our approach to study AngularJS was through an attempt
to integrate it into an existing KendoUI web application. 
&lt;/p&gt;
&lt;p&gt;
It&amp;#39;s rather straightforward to convert model from KendoUI into AngularJS, as logically
both frameworks are equal in this regard. But tactically KendoUI implements model-view
binding very differently than AngularJS does. KendoUI binds model to view immediately
per each model field, where AngularJS delays a binding of each model field and performs
whole model binding in one go. Angular&amp;#39;s approach is more performant, and even
more appealing to a developer, though the problem is that the time it takes to make
whole model binding is proportional to a size (number of objects and properties) of
model. This means that if you have a relatively big model you will experience tangible
halts in browser&amp;#39;s UI while a javascript updating view/model is running.
&lt;/p&gt;
&lt;p&gt;
AngularJS advices some workaround, which in essence is to avoid big model. The problem
is that a couple of thousands or even several hundrends of objects and properties
are already considered big model. So, you should immediately plan your model, and
view to avoid any potential impact. This seriously distracts from the task your&amp;#39;re
solving.
&lt;/p&gt;
&lt;p&gt;
The idea that your UI will halt for the time proportional to the size of your whole
model looks flawed in our opinion. KendoUI knows no such a problem. That&amp;#39;s the
reason why our KendoUI to AngularJS transition experience was not smooth.
&lt;/p&gt;
&lt;p&gt;
Our analysis of AngularJS sources shows that the issue could be resolved provided
model to view binding (it&amp;#39;s called digest in that library) was asynchronous.
&lt;/p&gt;
&lt;p&gt;
To verify our ideas we have created a branch &lt;a href="https://github.com/nesterovsky-bros/angular.js"&gt;nesterovsky-bros/angular.js&lt;/a&gt; where
we implemented required refactorings. It includes: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
API based on existing deferred/promise to write algorithms in async way, and 
&lt;/li&gt;
&lt;li&gt;
refactored digest logic.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
At the end we have proposed to integrate our changes into the main branch: &lt;a href="https://github.com/angular/angular.js/pull/7548"&gt;Make
$digest async&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
We&amp;#39;re not sure whether our proposition will be integrated (rather no than yes).
Nevertheless what we have come with is an interesting extension of deferred object
that we neither have seen in AngularJS nor in JQuery, so later we will quote that
API from &lt;a href="https://github.com/nesterovsky-bros/angular.js/blob/master/src/ng/q.js"&gt;q.js&lt;/a&gt; and &lt;a href="https://github.com/nesterovsky-bros/angular.js/blob/master/src/ng/scheduler.js"&gt;scheduler.js&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=044c2188-ce3c-43a9-a7aa-0b98d88bb19f" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,044c2188-ce3c-43a9-a7aa-0b98d88bb19f.aspx</comments>
      <category>AngularJS</category>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Thinking aloud</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=be57df20-9025-4f1b-849e-5b982df91f7a</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,be57df20-9025-4f1b-849e-5b982df91f7a.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=be57df20-9025-4f1b-849e-5b982df91f7a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the article <a href="http://www.nesterovsky-bros.com/weblog/2013/05/13/ErrorHandlingInWCFBasedWebApplications.aspx">"Error
handling in WCF based web applications"</a> we've shown a custom error handler
for RESTful service based on WCF. This time we shall do the same for Web API 2.1 service. 
</p>
        <p>
Web API 2.1 provides an elegant way to implementat custom error handlers/loggers,
see <a href="http://www.asp.net/web-api/overview/web-api-routing-and-actions/web-api-global-error-handling">the
following article.</a> Web API permits many error loggers followed by a single error
handler for all uncaught exceptions. A default error handler knows to output an error
both in XML and JSON formats depending on requested MIME type. 
</p>
        <p>
In our projects we use unique error reference IDs. This feature allows to an end-user
to refer to any error that has happened during the application life time and pass
such error ID to the technical support for further investigations. Thus, error details
passed to the client-side contain an ErrorID field. An error logger generates ErrorID
and passes it over to an error handler for serialization. 
</p>
        <p>
Let's look at our error handling implementation for a Web API application. 
</p>
        <p>
The first part is an implementation of <code>IExceptionLogger</code> interface. It
assigns ErrorID and logs all errors: 
</p>
        <p style="padding-left: 1em">
          <code> /// Defines a global logger for unhandled exceptions.<br />
public class GlobalExceptionLogger : ExceptionLogger<br />
{<br />
/// Writes log record to the database synchronously.<br />
public override void Log(ExceptionLoggerContext context)<br />
{<br />
try<br />
{<br />
var request = context.Request;<br />
var exception = context.Exception;<br /><br />
var id = LogError(<br />
request.RequestUri.ToString(),<br />
context.RequestContext == null ?<br />
null : context.RequestContext.Principal.Identity.Name,<br />
request.ToString(),<br />
exception.Message,<br />
exception.StackTrace);<br /><br />
// associates retrieved error ID with the current exception<br />
exception.Data["NesterovskyBros:id"] = id;<br />
}<br />
catch<br />
{<br />
// logger shouldn't throw an exception!!!<br />
}<br />
}<br /><br />
// in the real life this method may store all relevant info into a database.<br />
private long LogError(<br />
string address,<br />
string userid,<br />
string request,<br />
string message,<br />
string stackTrace)<br />
{<br />
...<br />
}<br />
} </code>
        </p>
        <p>
The second part is the implementation of <code>IExceptionHandler</code>:
</p>
        <p style="padding-left: 1em">
          <code> /// Defines a global handler for unhandled exceptions.<br />
public class GlobalExceptionHandler : ExceptionHandler<br />
{<br />
/// This core method should implement custom error handling, if any.<br />
/// It determines how an exception will be serialized for client-side processing.<br />
public override void Handle(ExceptionHandlerContext context)<br />
{<br />
var requestContext = context.RequestContext;<br />
var config = requestContext.Configuration;<br /><br />
context.Result = new ErrorResult(<br />
context.Exception,<br />
requestContext == null ? false : requestContext.IncludeErrorDetail,<br />
config.Services.GetContentNegotiator(),<br />
context.Request,<br />
config.Formatters);<br />
}<br /><br />
/// An implementation of IHttpActionResult interface.<br />
private class ErrorResult : ExceptionResult<br />
{<br />
public ErrorResult(<br />
Exception exception,<br />
bool includeErrorDetail,<br />
IContentNegotiator negotiator,<br />
HttpRequestMessage request,<br />
IEnumerable&lt;MediaTypeFormatter&gt; formatters) :<br />
base(exception, includeErrorDetail, negotiator, request, formatters)<br />
{<br />
}<br /><br />
/// Creates an HttpResponseMessage instance asynchronously.<br />
/// This method determines how a HttpResponseMessage content will look like.<br />
public override Task&lt;HttpResponseMessage&gt; ExecuteAsync(CancellationToken cancellationToken)<br />
{<br />
var content = new HttpError(Exception, IncludeErrorDetail);<br /><br />
// define an additional content field with name "ErrorID"<br />
content.Add("ErrorID", Exception.Data["NesterovskyBros:id"] as long?);<br /><br />
var result =<br />
ContentNegotiator.Negotiate(typeof(HttpError), Request, Formatters);<br /><br />
var message = new HttpResponseMessage<br />
{<br />
RequestMessage = Request,<br />
StatusCode = result == null ?<br />
HttpStatusCode.NotAcceptable : HttpStatusCode.InternalServerError<br />
};<br /><br />
if (result != null)<br />
{<br />
try<br />
{<br />
// serializes the HttpError instance either to JSON or to XML<br />
// depend on requested by the client MIME type.<br />
message.Content = new ObjectContent&lt;HttpError&gt;(<br />
content,<br />
result.Formatter,<br />
result.MediaType);<br />
}<br />
catch<br />
{<br />
message.Dispose();<br /><br />
throw;<br />
}<br />
}<br /><br />
return Task.FromResult(message);<br />
}<br />
}<br />
} </code>
        </p>
        <p>
Last, but not least part of this solution is registration and configuration of the
error logger/handler: 
</p>
        <p style="padding-left: 1em">
          <code> /// WebApi congiguation.<br />
public static class WebApiConfig<br />
{<br />
public static void Register(HttpConfiguration config)<br />
{<br />
...<br /><br />
// register the exception logger and handler<br />
config.Services.Add(typeof(IExceptionLogger), new GlobalExceptionLogger());<br />
config.Services.Replace(typeof(IExceptionHandler), new GlobalExceptionHandler());<br /><br />
// set error detail policy according with value from Web.config<br />
var customErrors =<br />
(CustomErrorsSection)ConfigurationManager.GetSection("system.web/customErrors");<br /><br />
if (customErrors != null)<br />
{<br />
switch (customErrors.Mode)<br />
{<br />
case CustomErrorsMode.RemoteOnly:<br />
{<br />
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;<br /><br />
break;<br />
}<br />
case CustomErrorsMode.On:<br />
{<br />
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Never;<br /><br />
break;<br />
}<br />
case CustomErrorsMode.Off:<br />
{<br />
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;<br /><br />
break;<br />
}<br />
default:<br />
{<br />
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Default;<br /><br />
break;<br />
}<br />
}<br />
}<br />
}<br />
} </code>
        </p>
        <p>
The client-side error handler remain almost untouched. The implementation details
you may find in <code>/Scripts/api/api.js</code> and <code>Scripts/controls/error.js</code> files. 
</p>
        <p>
You may <a href="http://www.nesterovsky-bros.com/download/GlobalErrorHandler.zip">download
the demo project here</a>. Feel free to use this solution in your .NET projects. 
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=be57df20-9025-4f1b-849e-5b982df91f7a" />
      </body>
      <title>Custom error handling with Web API</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,be57df20-9025-4f1b-849e-5b982df91f7a.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2014/03/10/CustomErrorHandlingWithWebAPI.aspx</link>
      <pubDate>Mon, 10 Mar 2014 10:56:24 GMT</pubDate>
      <description>    &lt;p&gt;
In the article &lt;a href="http://www.nesterovsky-bros.com/weblog/2013/05/13/ErrorHandlingInWCFBasedWebApplications.aspx"&gt;&amp;quot;Error
handling in WCF based web applications&amp;quot;&lt;/a&gt; we've shown a custom error handler
for RESTful service based on WCF. This time we shall do the same for Web API 2.1 service. 
&lt;/p&gt;
&lt;p&gt;
Web API 2.1 provides an elegant way to implementat custom error handlers/loggers,
see &lt;a href="http://www.asp.net/web-api/overview/web-api-routing-and-actions/web-api-global-error-handling"&gt;the
following article.&lt;/a&gt; Web API permits many error loggers followed by a single error
handler for all uncaught exceptions. A default error handler knows to output an error
both in XML and JSON formats depending on requested MIME type. 
&lt;/p&gt;
&lt;p&gt;
In our projects we use unique error reference IDs. This feature allows to an end-user
to refer to any error that has happened during the application life time and pass
such error ID to the technical support for further investigations. Thus, error details
passed to the client-side contain an ErrorID field. An error logger generates ErrorID
and passes it over to an error handler for serialization. 
&lt;/p&gt;
&lt;p&gt;
Let's look at our error handling implementation for a Web API application. 
&lt;/p&gt;
&lt;p&gt;
The first part is an implementation of &lt;code&gt;IExceptionLogger&lt;/code&gt; interface. It
assigns ErrorID and logs all errors: 
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; /// Defines a global logger for unhandled exceptions.&lt;br /&gt;
public class GlobalExceptionLogger : ExceptionLogger&lt;br /&gt;
{&lt;br /&gt;
/// Writes log record to the database synchronously.&lt;br /&gt;
public override void Log(ExceptionLoggerContext context)&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
var request = context.Request;&lt;br /&gt;
var exception = context.Exception;&lt;br /&gt;
&lt;br /&gt;
var id = LogError(&lt;br /&gt;
request.RequestUri.ToString(),&lt;br /&gt;
context.RequestContext == null ?&lt;br /&gt;
null : context.RequestContext.Principal.Identity.Name,&lt;br /&gt;
request.ToString(),&lt;br /&gt;
exception.Message,&lt;br /&gt;
exception.StackTrace);&lt;br /&gt;
&lt;br /&gt;
// associates retrieved error ID with the current exception&lt;br /&gt;
exception.Data["NesterovskyBros:id"] = id;&lt;br /&gt;
}&lt;br /&gt;
catch&lt;br /&gt;
{&lt;br /&gt;
// logger shouldn't throw an exception!!!&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// in the real life this method may store all relevant info into a database.&lt;br /&gt;
private long LogError(&lt;br /&gt;
string address,&lt;br /&gt;
string userid,&lt;br /&gt;
string request,&lt;br /&gt;
string message,&lt;br /&gt;
string stackTrace)&lt;br /&gt;
{&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
} &lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
The second part is the implementation of &lt;code&gt;IExceptionHandler&lt;/code&gt;:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; /// Defines a global handler for unhandled exceptions.&lt;br /&gt;
public class GlobalExceptionHandler : ExceptionHandler&lt;br /&gt;
{&lt;br /&gt;
/// This core method should implement custom error handling, if any.&lt;br /&gt;
/// It determines how an exception will be serialized for client-side processing.&lt;br /&gt;
public override void Handle(ExceptionHandlerContext context)&lt;br /&gt;
{&lt;br /&gt;
var requestContext = context.RequestContext;&lt;br /&gt;
var config = requestContext.Configuration;&lt;br /&gt;
&lt;br /&gt;
context.Result = new ErrorResult(&lt;br /&gt;
context.Exception,&lt;br /&gt;
requestContext == null ? false : requestContext.IncludeErrorDetail,&lt;br /&gt;
config.Services.GetContentNegotiator(),&lt;br /&gt;
context.Request,&lt;br /&gt;
config.Formatters);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/// An implementation of IHttpActionResult interface.&lt;br /&gt;
private class ErrorResult : ExceptionResult&lt;br /&gt;
{&lt;br /&gt;
public ErrorResult(&lt;br /&gt;
Exception exception,&lt;br /&gt;
bool includeErrorDetail,&lt;br /&gt;
IContentNegotiator negotiator,&lt;br /&gt;
HttpRequestMessage request,&lt;br /&gt;
IEnumerable&amp;lt;MediaTypeFormatter&gt; formatters) :&lt;br /&gt;
base(exception, includeErrorDetail, negotiator, request, formatters)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/// Creates an HttpResponseMessage instance asynchronously.&lt;br /&gt;
/// This method determines how a HttpResponseMessage content will look like.&lt;br /&gt;
public override Task&amp;lt;HttpResponseMessage&gt; ExecuteAsync(CancellationToken cancellationToken)&lt;br /&gt;
{&lt;br /&gt;
var content = new HttpError(Exception, IncludeErrorDetail);&lt;br /&gt;
&lt;br /&gt;
// define an additional content field with name "ErrorID"&lt;br /&gt;
content.Add("ErrorID", Exception.Data["NesterovskyBros:id"] as long?);&lt;br /&gt;
&lt;br /&gt;
var result =&lt;br /&gt;
ContentNegotiator.Negotiate(typeof(HttpError), Request, Formatters);&lt;br /&gt;
&lt;br /&gt;
var message = new HttpResponseMessage&lt;br /&gt;
{&lt;br /&gt;
RequestMessage = Request,&lt;br /&gt;
StatusCode = result == null ?&lt;br /&gt;
HttpStatusCode.NotAcceptable : HttpStatusCode.InternalServerError&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
if (result != null)&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
// serializes the HttpError instance either to JSON or to XML&lt;br /&gt;
// depend on requested by the client MIME type.&lt;br /&gt;
message.Content = new ObjectContent&amp;lt;HttpError&gt;(&lt;br /&gt;
content,&lt;br /&gt;
result.Formatter,&lt;br /&gt;
result.MediaType);&lt;br /&gt;
}&lt;br /&gt;
catch&lt;br /&gt;
{&lt;br /&gt;
message.Dispose();&lt;br /&gt;
&lt;br /&gt;
throw;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return Task.FromResult(message);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
} &lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
Last, but not least part of this solution is registration and configuration of the
error logger/handler: 
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; /// WebApi congiguation.&lt;br /&gt;
public static class WebApiConfig&lt;br /&gt;
{&lt;br /&gt;
public static void Register(HttpConfiguration config)&lt;br /&gt;
{&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// register the exception logger and handler&lt;br /&gt;
config.Services.Add(typeof(IExceptionLogger), new GlobalExceptionLogger());&lt;br /&gt;
config.Services.Replace(typeof(IExceptionHandler), new GlobalExceptionHandler());&lt;br /&gt;
&lt;br /&gt;
// set error detail policy according with value from Web.config&lt;br /&gt;
var customErrors =&lt;br /&gt;
(CustomErrorsSection)ConfigurationManager.GetSection("system.web/customErrors");&lt;br /&gt;
&lt;br /&gt;
if (customErrors != null)&lt;br /&gt;
{&lt;br /&gt;
switch (customErrors.Mode)&lt;br /&gt;
{&lt;br /&gt;
case CustomErrorsMode.RemoteOnly:&lt;br /&gt;
{&lt;br /&gt;
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
case CustomErrorsMode.On:&lt;br /&gt;
{&lt;br /&gt;
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Never;&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
case CustomErrorsMode.Off:&lt;br /&gt;
{&lt;br /&gt;
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
default:&lt;br /&gt;
{&lt;br /&gt;
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Default;&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
} &lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
The client-side error handler remain almost untouched. The implementation details
you may find in &lt;code&gt;/Scripts/api/api.js&lt;/code&gt; and &lt;code&gt;Scripts/controls/error.js&lt;/code&gt; files. 
&lt;/p&gt;
&lt;p&gt;
You may &lt;a href="http://www.nesterovsky-bros.com/download/GlobalErrorHandler.zip"&gt;download
the demo project here&lt;/a&gt;. Feel free to use this solution in your .NET projects. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=be57df20-9025-4f1b-849e-5b982df91f7a" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,be57df20-9025-4f1b-849e-5b982df91f7a.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Tips and tricks</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=c7c57f76-19a7-4b95-a957-2fa974dd72b2</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,c7c57f76-19a7-4b95-a957-2fa974dd72b2.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=c7c57f76-19a7-4b95-a957-2fa974dd72b2</wfw:commentRss>
      <title>KendoUI's guid function</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,c7c57f76-19a7-4b95-a957-2fa974dd72b2.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/08/09/KendoUIsGuidFunction.aspx</link>
      <pubDate>Fri, 09 Aug 2013 14:24:16 GMT</pubDate>
      <description>  &lt;p&gt;
Earlier we have written a post &lt;a href="http://www.nesterovsky-bros.com/weblog/2013/07/30/KendoUIsSlowestFunction.aspx"&gt;KendoUI's
slowest function&lt;/a&gt; and now, we want to point to the next slow function, which is &lt;code&gt;kendo.guid()&lt;/code&gt;.
It&amp;#39;s used to assign &lt;code&gt;uid&lt;/code&gt; to each observable object, and also in couple
of other places.
&lt;/p&gt;
&lt;p&gt;
Here is its source:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; guid: function() {&lt;br /&gt;
var id = "", i, random;&lt;br /&gt;
&lt;br /&gt;
for (i = 0; i &amp;lt; 32; i++) {&lt;br /&gt;
random = math.random() * 16 | 0;&lt;br /&gt;
&lt;br /&gt;
if (i == 8 || i == 12 || i == 16 || i == 20) {&lt;br /&gt;
id += "-";&lt;br /&gt;
}&lt;br /&gt;
id += (i == 12 ? 4 : (i == 16 ? (random &amp; 3 | 8) : random)).toString(16);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return id;&lt;br /&gt;
} &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
KendoUI people have decided to define &lt;code&gt;uid&lt;/code&gt; as a string in format of &lt;a href="http://en.wikipedia.org/wiki/Globally_unique_identifier"&gt;Globally
unique identifier&lt;/a&gt;. We think there is no reason to have such a complex value; it&amp;#39;s
enough to have counter to generate &lt;code&gt;uid&lt;/code&gt; values. As KendoUI relies on the
string type of &lt;code&gt;uid&lt;/code&gt;, so we have defined a patch like this:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; var guid = 0&lt;br /&gt;
&lt;br /&gt;
kendo.guid = function() { return ++guid + &amp;quot;&amp;quot; } &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Consider now a test case. It&amp;#39;s almost identical to that in previous post:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Test&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;script src="scripts/jquery/jquery.min..js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script src="scripts/kendo/kendo.web.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;link href="styles/kendo.common.min.css" rel="stylesheet" /&amp;gt;&lt;br /&gt;
&amp;lt;link href="styles/kendo.default.min.css" rel="stylesheet" /&amp;gt;&lt;br /&gt;
&amp;lt;link href="styles/style.css" rel="stylesheet" /&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
var model;&lt;br /&gt;
&lt;br /&gt;
function init()&lt;br /&gt;
{&lt;br /&gt;
var source = [];&lt;br /&gt;
&lt;br /&gt;
for(var i = 0; i &amp;lt; 1000; ++i)&lt;br /&gt;
{&lt;br /&gt;
source.push({ text: "value " + i, value: "" + i });&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
model = kendo.observable(&lt;br /&gt;
{&lt;br /&gt;
value: "1",&lt;br /&gt;
source: new kendo.data.DataSource(&lt;br /&gt;
{&lt;br /&gt;
data: source&lt;br /&gt;
})&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
model.source.read();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function patch()&lt;br /&gt;
{&lt;br /&gt;
var base = kendo.data.binders.widget.source.fn._ns;&lt;br /&gt;
var result;&lt;br /&gt;
&lt;b&gt;var guid = 0;&lt;br /&gt;
&lt;br /&gt;
kendo.guid = function() { return ++guid + &amp;quot;&amp;quot;; };&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
kendo.data.binders.widget.source.fn._ns = function(ns)&lt;br /&gt;
{&lt;br /&gt;
return ns ? base.call(this, ns) :&lt;br /&gt;
(result || (result = base.call(this, ns)));&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function test()&lt;br /&gt;
{&lt;br /&gt;
init();&lt;br /&gt;
kendo.bind("#view", model);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
patch();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;button onclick="test()"&amp;gt;Click to start test&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p id="view"&amp;gt;&lt;br /&gt;
Select: 
&lt;br /&gt;
&amp;lt;input data-role="dropdownlist" 
&lt;br /&gt;
data-bind="value: value, source: source" 
&lt;br /&gt;
data-text-field="text" 
&lt;br /&gt;
data-value-field="value"/&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
Now, we can compare performance with and without that patch.
&lt;/p&gt;
&lt;p&gt;
Here is a run statistics without patch: 
&lt;/p&gt;
&lt;div style="padding-left: 1em"&gt;
&lt;table border="1"&gt;
&lt;colgroup&gt;
&lt;col /&gt;
&lt;col /&gt;
&lt;col /&gt;
&lt;col /&gt;
&lt;col style="color: blue" /&gt;
&lt;col /&gt;
&lt;/colgroup&gt;
&lt;tr&gt;
&lt;td&gt;
Level&lt;/td&gt;
&lt;td&gt;
Function&lt;/td&gt;
&lt;td&gt;
Count&lt;/td&gt;
&lt;td&gt;
Inclusive time (ms)&lt;/td&gt;
&lt;td&gt;
Inclusive time %&lt;/td&gt;
&lt;td&gt;
Avg time (ms)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
onclick&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
270.73&lt;/td&gt;
&lt;td&gt;
100&lt;/td&gt;
&lt;td&gt;
270.73&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1.1&lt;/td&gt;
&lt;td&gt;
test&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
269.73&lt;/td&gt;
&lt;td&gt;
99.63&lt;/td&gt;
&lt;td&gt;
269.73&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1.1.1&lt;/td&gt;
&lt;td&gt;
init&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
117.07&lt;/td&gt;
&lt;td&gt;
43.24&lt;/td&gt;
&lt;td&gt;
117.07&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="color: red"&gt;
&lt;td&gt;
1.1.1.1&lt;/td&gt;
&lt;td&gt;
guid&lt;/td&gt;
&lt;td&gt;
1,001&lt;/td&gt;
&lt;td&gt;
72.05&lt;/td&gt;
&lt;td&gt;
26.61&lt;/td&gt;
&lt;td&gt;
0.07&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1.1.2&lt;/td&gt;
&lt;td&gt;
bind&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
152.65&lt;/td&gt;
&lt;td&gt;
56.39&lt;/td&gt;
&lt;td&gt;
152.65&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;
and with patch:
&lt;/p&gt;
&lt;div style="padding-left: 1em"&gt;
&lt;table border="1"&gt;
&lt;colgroup&gt;
&lt;col /&gt;
&lt;col /&gt;
&lt;col /&gt;
&lt;col /&gt;
&lt;col style="color: blue" /&gt;
&lt;col /&gt;
&lt;/colgroup&gt;
&lt;tr&gt;
&lt;td&gt;
Level&lt;/td&gt;
&lt;td&gt;
Function&lt;/td&gt;
&lt;td&gt;
Count&lt;/td&gt;
&lt;td&gt;
Inclusive time (ms)&lt;/td&gt;
&lt;td&gt;
Inclusive time %&lt;/td&gt;
&lt;td&gt;
Avg time (ms)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
onclick&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
172.64&lt;/td&gt;
&lt;td&gt;
100&lt;/td&gt;
&lt;td&gt;
172.64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1.1&lt;/td&gt;
&lt;td&gt;
test&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
171.65&lt;/td&gt;
&lt;td&gt;
99.42&lt;/td&gt;
&lt;td&gt;
171.65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1.1.1&lt;/td&gt;
&lt;td&gt;
init&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
62.04&lt;/td&gt;
&lt;td&gt;
35.94&lt;/td&gt;
&lt;td&gt;
62.04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="color: red"&gt;
&lt;td&gt;
1.1.1.1&lt;/td&gt;
&lt;td&gt;
guid&lt;/td&gt;
&lt;td&gt;
1,001&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
0.58&lt;/td&gt;
&lt;td&gt;
0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1.1.2&lt;/td&gt;
&lt;td&gt;
bind&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
109.6&lt;/td&gt;
&lt;td&gt;
63.49&lt;/td&gt;
&lt;td&gt;
109.6&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;
Note that statistics were collected for IE 10.&lt;br /&gt;
An example can be found at &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/slow2.html"&gt;slow2.html&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=c7c57f76-19a7-4b95-a957-2fa974dd72b2" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,c7c57f76-19a7-4b95-a957-2fa974dd72b2.aspx</comments>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Tips and tricks</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=f547a097-798e-4a6a-8394-e1bcba40f7ca</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,f547a097-798e-4a6a-8394-e1bcba40f7ca.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=f547a097-798e-4a6a-8394-e1bcba40f7ca</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
What is the slowest function in kendo? Or better, which function has most negative
performance impact in kendo. 
</p>
        <p>
Recently, we were dealing with a simple page, which was too slow, as data binding
took more than second. 
</p>
        <p>
The page contained a dropdown list, with ~1000 options. To understand the reason we
have run this page under the IE's built-in javascript profiler, and ... 
</p>
        <p>
there, we have found that almost half of the time is taken by a function (call it
X), which receives nothing and returns always the same result! 
</p>
        <p>
But, let's now see a minimal example that demostrates the problem: 
</p>
        <p style="padding-left: 1em">
          <code>&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
  &lt;head&gt;<br />
    &lt;title&gt;Test&lt;/title&gt;<br />
    &lt;script src="scripts/jquery/jquery.js"&gt;&lt;/script&gt;<br />
    &lt;script src="scripts/kendo/kendo.web.min.js"&gt;&lt;/script&gt;<br />
    &lt;link href="styles/kendo.common.min.css" rel="stylesheet" /&gt;<br />
    &lt;link href="styles/kendo.default.min.css" rel="stylesheet" /&gt;<br />
    &lt;link href="styles/style.css" rel="stylesheet" /&gt;<br />
    &lt;script&gt;<br />
var model;<br /><br />
function init()<br />
{<br />
  var source = [];<br /><br />
  for(var i = 0; i &lt; 1000; ++i)<br />
  {<br />
    source.push({ text: "value " + i, value: "" + i });<br />
  }<br /><br />
  model = kendo.observable(<br />
  {<br />
    value: "1",<br />
    source: new kendo.data.DataSource(<br />
    {<br />
      data: source<br />
    })<br />
  });<br /><br />
  model.source.read();<br />
}<br /><br />
function test()<br />
{<br />
  kendo.bind("#view", model);<br />
}<br /><br />
init();<br />
  &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;p&gt;<br />
  &lt;button onclick="test()"&gt;Click to start test&lt;/button&gt;<br />
&lt;/p&gt;<br />
&lt;p id="view"&gt;<br />
  Select: 
<br />
  &lt;input data-role="dropdownlist" 
<br />
    data-bind="value: value, source: source" 
<br />
    data-text-field="text" 
<br />
    data-value-field="value"/&gt;<br />
&lt;/p&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</code>
        </p>
        <p>
There are two parts: initialization, and a test itself that starts upon button click. 
</p>
        <p>
In the initialization part we have defined a model, containing a datasource. 
</p>
        <p>
The test part performs data binding. 
</p>
        <p>
Now, here is a run statistics: 
</p>
        <div style="padding-left: 1em">
          <table border="1">
            <tr>
              <td>
Function</td>
              <td>
Count</td>
              <td>
Inclusive time (ms)</td>
              <td>
Inclusive time %</td>
              <td>
Avg time (ms)</td>
            </tr>
            <tr>
              <td>
test</td>
              <td>
1</td>
              <td>
456.05</td>
              <td>
100</td>
              <td>
456.05</td>
            </tr>
            <tr>
              <td>
X</td>
              <td>
1,000</td>
              <td>
200.14</td>
              <td>
43.89</td>
              <td>
0.2</td>
            </tr>
          </table>
        </div>
        <p>
So, X is fast by itself, but it run 1000 times, and took about 44% of all time. 
</p>
        <p>
And now, to the function. It's <b><code>kendo.data.binders.widget.source.fn._ns</code></b>.
</p>
        <p>
Here is its code:
</p>
        <p style="padding-left: 1em">
          <code> _ns: function(ns) {<br />
  ns = ns || kendo.ui;<br />
  var all = [ kendo.ui, kendo.dataviz.ui, kendo.mobile.ui ];<br />
  all.splice($.inArray(ns, all), 1);<br />
  all.unshift(ns);<br /><br />
  return kendo.rolesFromNamespaces(all);<br />
}</code>
        </p>
        <p>
We can see that on each call it receives a parameter <b><code>undefined</code></b>,
and always returns an array with the same content. Not sure why Kendo UI team made
it so complex, but one can easily device a simple patch that optimizes this code path.
</p>
        <p style="padding-left: 1em">
          <code>function patch()<br />
{<br />
  var base = kendo.data.binders.widget.source.fn._ns;<br />
  var result;<br /><br />
  kendo.data.binders.widget.source.fn._ns = function(ns)<br />
  {<br />
    return ns ? base.call(this, ns) :<br />
      (result || (result = base.call(this, ns)));<br />
  }<br />
}</code>
        </p>
        <p>
With this patch applied, the profiler shows:
</p>
        <div style="padding-left: 1em">
          <table border="1">
            <tr>
              <td>
Function</td>
              <td>
Count</td>
              <td>
Inclusive time (ms)</td>
              <td>
Inclusive time %</td>
              <td>
Avg time (ms)</td>
            </tr>
            <tr>
              <td>
test</td>
              <td>
1</td>
              <td>
253.03</td>
              <td>
100</td>
              <td>
253.03</td>
            </tr>
            <tr>
              <td>
_ns</td>
              <td>
1,000</td>
              <td>
6</td>
              <td>
2.37</td>
              <td>
0.01</td>
            </tr>
          </table>
        </div>
        <p>
Execution time dropped considerably, and _ns() loses its title of most time consuming
function!
</p>
        <p>
An example can be found at <a href="http://www.nesterovsky-bros.com/download/KendoUI/slow.html">slow.html</a>.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=f547a097-798e-4a6a-8394-e1bcba40f7ca" />
      </body>
      <title>KendoUI's slowest function</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,f547a097-798e-4a6a-8394-e1bcba40f7ca.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/07/30/KendoUIsSlowestFunction.aspx</link>
      <pubDate>Tue, 30 Jul 2013 20:47:11 GMT</pubDate>
      <description>  &lt;p&gt;
What is the slowest function in kendo? Or better, which function has most negative
performance impact in kendo. 
&lt;/p&gt;
&lt;p&gt;
Recently, we were dealing with a simple page, which was too slow, as data binding
took more than second. 
&lt;/p&gt;
&lt;p&gt;
The page contained a dropdown list, with ~1000 options. To understand the reason we
have run this page under the IE&amp;#39;s built-in javascript profiler, and ... 
&lt;/p&gt;
&lt;p&gt;
there, we have found that almost half of the time is taken by a function (call it
X), which receives nothing and returns always the same result! 
&lt;/p&gt;
&lt;p&gt;
But, let&amp;#39;s now see a minimal example that demostrates the problem: 
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;head&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;Test&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script src="scripts/jquery/jquery.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script src="scripts/kendo/kendo.web.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link href="styles/kendo.common.min.css" rel="stylesheet" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link href="styles/kendo.default.min.css" rel="stylesheet" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link href="styles/style.css" rel="stylesheet" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script&amp;gt;&lt;br /&gt;
var model;&lt;br /&gt;
&lt;br /&gt;
function init()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; var source = [];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; for(var i = 0; i &amp;lt; 1000; ++i)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; source.push({ text: "value " + i, value: "" + i });&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; model = kendo.observable(&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; value: "1",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; source: new kendo.data.DataSource(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: source&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; })&lt;br /&gt;
&amp;nbsp; });&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; model.source.read();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function test()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; kendo.bind("#view", model);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
init();&lt;br /&gt;
&amp;nbsp; &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;button onclick="test()"&amp;gt;Click to start test&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p id="view"&amp;gt;&lt;br /&gt;
&amp;nbsp; Select: 
&lt;br /&gt;
&amp;nbsp; &amp;lt;input data-role="dropdownlist" 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; data-bind="value: value, source: source" 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; data-text-field="text" 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; data-value-field="value"/&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
There are two parts: initialization, and a test itself that starts upon button click. 
&lt;/p&gt;
&lt;p&gt;
In the initialization part we have defined a model, containing a datasource. 
&lt;/p&gt;
&lt;p&gt;
The test part performs data binding. 
&lt;/p&gt;
&lt;p&gt;
Now, here is a run statistics: 
&lt;/p&gt;
&lt;div style="padding-left: 1em"&gt;
&lt;table border="1"&gt;
&lt;tr&gt;
&lt;td&gt;
Function&lt;/td&gt;
&lt;td&gt;
Count&lt;/td&gt;
&lt;td&gt;
Inclusive time (ms)&lt;/td&gt;
&lt;td&gt;
Inclusive time %&lt;/td&gt;
&lt;td&gt;
Avg time (ms)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
test&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
456.05&lt;/td&gt;
&lt;td&gt;
100&lt;/td&gt;
&lt;td&gt;
456.05&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
X&lt;/td&gt;
&lt;td&gt;
1,000&lt;/td&gt;
&lt;td&gt;
200.14&lt;/td&gt;
&lt;td&gt;
43.89&lt;/td&gt;
&lt;td&gt;
0.2&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;
So, X is fast by itself, but it run 1000 times, and took about 44% of all time. 
&lt;/p&gt;
&lt;p&gt;
And now, to the function. It&amp;#39;s &lt;b&gt;&lt;code&gt;kendo.data.binders.widget.source.fn._ns&lt;/code&gt;&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
Here is its code:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; _ns: function(ns) {&lt;br /&gt;
&amp;nbsp; ns = ns || kendo.ui;&lt;br /&gt;
&amp;nbsp; var all = [ kendo.ui, kendo.dataviz.ui, kendo.mobile.ui ];&lt;br /&gt;
&amp;nbsp; all.splice($.inArray(ns, all), 1);&lt;br /&gt;
&amp;nbsp; all.unshift(ns);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; return kendo.rolesFromNamespaces(all);&lt;br /&gt;
}&lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
We can see that on each call it receives a parameter &lt;b&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/b&gt;,
and always returns an array with the same content. Not sure why Kendo UI team made
it so complex, but one can easily device a simple patch that optimizes this code path.
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;function patch()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; var base = kendo.data.binders.widget.source.fn._ns;&lt;br /&gt;
&amp;nbsp; var result;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; kendo.data.binders.widget.source.fn._ns = function(ns)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return ns ? base.call(this, ns) :&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (result || (result = base.call(this, ns)));&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
With this patch applied, the profiler shows:
&lt;/p&gt;
&lt;div style="padding-left: 1em"&gt;
&lt;table border="1"&gt;
&lt;tr&gt;
&lt;td&gt;
Function&lt;/td&gt;
&lt;td&gt;
Count&lt;/td&gt;
&lt;td&gt;
Inclusive time (ms)&lt;/td&gt;
&lt;td&gt;
Inclusive time %&lt;/td&gt;
&lt;td&gt;
Avg time (ms)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
test&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;td&gt;
253.03&lt;/td&gt;
&lt;td&gt;
100&lt;/td&gt;
&lt;td&gt;
253.03&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
_ns&lt;/td&gt;
&lt;td&gt;
1,000&lt;/td&gt;
&lt;td&gt;
6&lt;/td&gt;
&lt;td&gt;
2.37&lt;/td&gt;
&lt;td&gt;
0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;
Execution time dropped considerably, and _ns() loses its title of most time consuming
function!
&lt;/p&gt;
&lt;p&gt;
An example can be found at &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/slow.html"&gt;slow.html&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=f547a097-798e-4a6a-8394-e1bcba40f7ca" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,f547a097-798e-4a6a-8394-e1bcba40f7ca.aspx</comments>
      <category>javascript</category>
      <category>kendoui</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=a261b664-a0a6-4fd2-b321-19c48f72235b</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,a261b664-a0a6-4fd2-b321-19c48f72235b.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=a261b664-a0a6-4fd2-b321-19c48f72235b</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Earlier, in the article <a href="http://www.nesterovsky-bros.com/weblog/2013/01/06/HowToLoadKendoUITemplatesFromExternalFiles.aspx">How
To: Load KendoUI Templates from External Files</a>, we were talking about the way
to combine project's templates into a single file using <a href="http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx"> Text
Templates</a>. Now, we would like to suggest the next step.
</p>
        <p>
KendoUI defines text templates that it knows to transform into functions, at runtime
obviously. Thus a template like this:
</p>
        <p style="padding-left: 1em">
          <code> &lt;tr&gt;<br />
  &lt;td data-bind=" text: name"&gt;&lt;/td&gt;<br />
  &lt;td&gt;#: kendo.toString(get("price"), "C") #&lt;/td&gt;<br />
  &lt;td data-bind="text: unitsInStock"&gt;&lt;/td&gt;<br />
  &lt;td&gt;&lt;button class="k-button" data-bind="click: deleteProduct"&gt;
Delete&lt;/button&gt;&lt;/td&gt;<br />
&lt;/tr&gt; </code>
        </p>
        <p>
is transformed into a function:
</p>
        <p style="padding-left: 1em">
          <code>function(data)<br />
{<br />
  var o,e=kendo.htmlEncode;<br /><br />
  with(data)<br />
  {<br />
    o='&lt;tr&gt;&lt;td data-bind="text: name"&gt;&lt;/td&gt;&lt;td&gt;'+<br />
      e( kendo.toString(get("price"), "C") )+<br />
      '&lt;/td&gt;&lt;td data-bind="text: unitsInStock"&gt;&lt;/td&gt;'
+ 
<br />
      '&lt;td&gt;&lt;button class="k-button" ' +<br />
      'data-bind="click: deleteProduct"&gt;Delete&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;';<br />
  }<br /><br />
  return o; 
<br />
} </code>
        </p>
        <p>
The transformation is done through a sequence of of regex replaces.
</p>
        <p>
Now, what's the fastest javascript template engine?
</p>
        <p>
Right! That, which does not work at runtime. <img alt=":-)" src="http://www.nesterovsky-bros.com/weblog/smilies/happy.gif" /></p>
        <p>
What we thought is that we can generate those functions at compile time rather than
defining templates.
</p>
        <p>
We have updated <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates.tt"> templates.tt</a> to
generate template functions, and optionally to generate <code>&lt;script&gt;</code> tags
that call those functions. This way, for an input <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates/footer.tmpl.html">footer.tmpl.html</a>:
</p>
        <p style="padding-left: 1em">
          <code> &lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt; 
<br />
  &lt;title&gt;Test&lt;/title&gt; 
<br />
  &lt;base href="/" /&gt; 
<br />
  &lt;link href="styles/kendo.common.min.css" rel="stylesheet"
/&gt; 
<br />
  &lt;link href="styles/kendo.default.min.css" rel="stylesheet"
/&gt; 
<br />
&lt;/head&gt; 
<br />
&lt;body&gt; 
<br />
  &lt;table data-template-id="view"&gt;<br />
    &lt;tr&gt; 
<br />
      &lt;td&gt;Products count: #: total() #&lt;/td&gt;<br />
      &lt;td&gt;Total price: #: totalPrice() #&lt;/td&gt; 
<br />
      &lt;td colspan="2"&gt;Units in stock: #:
totalUnitsInStock() #&lt;/td&gt; 
<br />
   &lt;/tr&gt; 
<br />
  &lt;/table&gt; 
<br />
&lt;/body&gt; 
<br />
&lt;/html&gt;</code>
        </p>
        <p>
 <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates.js">templates.js</a> will
look like this:
</p>
        <p style="padding-left: 1em">
          <code>nesterovskyBros.templates=<br />
{<br />
  ...<br />
  "footer-view":function(data)<br />
  {<br />
    var o,e=kendo.htmlEncode;<br /><br />
    with(data)<br />
    {<br />
      ...<br />
    }<br /><br />
    return o;<br />
  },<br />
  ...<br />
};<br /><br />
document.write('&lt;script id="footer-view-template" type="text/x-kendo-template"&gt;#=nesterovskyBros.templates["footer-view"](data)#&lt;/script&gt;');</code>
        </p>
        <p>
To get template function at runtime you simply refer to  <code>nesterovskyBros.templates["footer-view"]</code>.
</p>
        <p>
template.tt now allows you to specify:
</p>
        <ul>
          <li>
            <code>scope</code> - a javascript scope for tempate functions, e.g. "<code>nesterovskyBros.templates</code>";</li>
          <li>
            <code>data-script</code> attribute over each template (default is <code>true</code>)
to prevent generation of <code>&lt;script&gt;</code> tag;</li>
          <li>
            <code>data-with-block</code> attribute (default is <code>true</code>) to prevent <code>with(data)
{...}</code> statement in javascript.</li>
        </ul>
        <p>
See a <a href="http://www.nesterovsky-bros.com/download/KendoUI">sample</a> application
that shows how nicely KendoUI UserControls work with those compiled templates.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=a261b664-a0a6-4fd2-b321-19c48f72235b" />
      </body>
      <title>Compile KendoUI templates</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,a261b664-a0a6-4fd2-b321-19c48f72235b.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/07/07/CompileKendoUITemplates.aspx</link>
      <pubDate>Sun, 07 Jul 2013 18:54:57 GMT</pubDate>
      <description>  &lt;p&gt;
Earlier, in the article &lt;a href="http://www.nesterovsky-bros.com/weblog/2013/01/06/HowToLoadKendoUITemplatesFromExternalFiles.aspx"&gt;How
To: Load KendoUI Templates from External Files&lt;/a&gt;, we were talking about the way
to combine project&amp;#39;s templates into a single file using &lt;a href="http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx"&gt; Text
Templates&lt;/a&gt;. Now, we would like to suggest the next step.
&lt;/p&gt;
&lt;p&gt;
KendoUI defines text templates that it knows to transform into functions, at runtime
obviously. Thus a template like this:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; &amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;td data-bind=" text: name"&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;td&amp;gt;#: kendo.toString(get("price"), "C") #&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;td data-bind="text: unitsInStock"&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;td&amp;gt;&amp;lt;button class="k-button" data-bind="click: deleteProduct"&amp;gt;
Delete&amp;lt;/button&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt; &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
is transformed into a function:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;function(data)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; var o,e=kendo.htmlEncode;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; with(data)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; o='&amp;lt;tr&amp;gt;&amp;lt;td data-bind="text: name"&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;'+&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e( kendo.toString(get("price"), "C") )+&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;lt;/td&amp;gt;&amp;lt;td data-bind="text: unitsInStock"&amp;gt;&amp;lt;/td&amp;gt;&amp;#39;
+ 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;&amp;lt;td&amp;gt;&amp;lt;button class="k-button" &amp;#39; +&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;data-bind="click: deleteProduct"&amp;gt;Delete&amp;lt;/button&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;';&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; return o; 
&lt;br /&gt;
} &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
The transformation is done through a sequence of of regex replaces.
&lt;/p&gt;
&lt;p&gt;
Now, what&amp;#39;s the fastest javascript template engine?
&lt;/p&gt;
&lt;p&gt;
Right! That, which does not work at runtime. &lt;img alt=":-)" src="http://www.nesterovsky-bros.com/weblog/smilies/happy.gif"&gt;
&lt;/p&gt;
&lt;p&gt;
What we thought is that we can generate those functions at compile time rather than
defining templates.
&lt;/p&gt;
&lt;p&gt;
We have updated &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates.tt"&gt; templates.tt&lt;/a&gt; to
generate template functions, and optionally to generate &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags
that call those functions. This way, for an input &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates/footer.tmpl.html"&gt;footer.tmpl.html&lt;/a&gt;:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; &amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt; 
&lt;br /&gt;
&amp;nbsp; &amp;lt;title&amp;gt;Test&amp;lt;/title&amp;gt; 
&lt;br /&gt;
&amp;nbsp; &amp;lt;base href=&amp;quot;/&amp;quot; /&amp;gt; 
&lt;br /&gt;
&amp;nbsp; &amp;lt;link href=&amp;quot;styles/kendo.common.min.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot;
/&amp;gt; 
&lt;br /&gt;
&amp;nbsp; &amp;lt;link href=&amp;quot;styles/kendo.default.min.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot;
/&amp;gt; 
&lt;br /&gt;
&amp;lt;/head&amp;gt; 
&lt;br /&gt;
&amp;lt;body&amp;gt; 
&lt;br /&gt;
&amp;nbsp; &amp;lt;table data-template-id=&amp;quot;view&amp;quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt; 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;Products count: #: total() #&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;Total price: #: totalPrice() #&amp;lt;/td&amp;gt; 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td colspan=&amp;quot;2&amp;quot;&amp;gt;Units in stock: #:
totalUnitsInStock() #&amp;lt;/td&amp;gt; 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt; 
&lt;br /&gt;
&amp;nbsp; &amp;lt;/table&amp;gt; 
&lt;br /&gt;
&amp;lt;/body&amp;gt; 
&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates.js"&gt;templates.js&lt;/a&gt; will
look like this:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;nesterovskyBros.templates=&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; ...&lt;br /&gt;
&amp;nbsp; "footer-view":function(data)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var o,e=kendo.htmlEncode;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; with(data)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return o;&lt;br /&gt;
&amp;nbsp; },&lt;br /&gt;
&amp;nbsp; ...&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
document.write('&amp;lt;script id="footer-view-template" type="text/x-kendo-template"&amp;gt;#=nesterovskyBros.templates["footer-view"](data)#&amp;lt;/script&amp;gt;');&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
To get template function at runtime you simply refer to&amp;nbsp; &lt;code&gt;nesterovskyBros.templates[&amp;quot;footer-view&amp;quot;]&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
template.tt now allows you to specify:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scope&lt;/code&gt; - a javascript scope for tempate functions, e.g. &amp;quot;&lt;code&gt;nesterovskyBros.templates&lt;/code&gt;&amp;quot;;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data-script&lt;/code&gt; attribute over each template (default is &lt;code&gt;true&lt;/code&gt;)
to prevent generation of &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data-with-block&lt;/code&gt; attribute (default is &lt;code&gt;true&lt;/code&gt;) to prevent &lt;code&gt;with(data)
{...}&lt;/code&gt; statement in javascript.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
See a &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI"&gt;sample&lt;/a&gt; application
that shows how nicely KendoUI UserControls work with those compiled templates.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=a261b664-a0a6-4fd2-b321-19c48f72235b" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,a261b664-a0a6-4fd2-b321-19c48f72235b.aspx</comments>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Thinking aloud</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=c96c3810-95d1-46bd-b413-7fac0cdbf509</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,c96c3810-95d1-46bd-b413-7fac0cdbf509.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:comment>http://www.nesterovsky-bros.com/weblog/CommentView,guid,c96c3810-95d1-46bd-b413-7fac0cdbf509.aspx</wfw:comment>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=c96c3810-95d1-46bd-b413-7fac0cdbf509</wfw:commentRss>
      <title>Kendo progress utility</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,c96c3810-95d1-46bd-b413-7fac0cdbf509.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/05/28/KendoProgressUtility.aspx</link>
      <pubDate>Tue, 28 May 2013 05:54:52 GMT</pubDate>
      <description>  &lt;p&gt;
While developing with KendoUI we have found &lt;code&gt;kendo.ui.progress(container, toggle)&lt;/code&gt; function
to be very useful. It's used to show or hide a progress indicator in the container
element.
&lt;/p&gt;
&lt;p&gt;
At the same time we have found that we usually used it in a context of async operation.
This way, we want to show progress, perform some asynchronous operations, hide progress.
So, we clearly want to benifit from &lt;a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization"&gt; RAII&lt;/a&gt; pattern:
we would like to open a progress scope, and to perform some activity withing this
scope.
&lt;/p&gt;
&lt;p&gt;
Arguing like this, we have defined a utility function, which is the fusion of &lt;code&gt;kendo.ui.progress()&lt;/code&gt; and &lt;code&gt;$.when()&lt;/code&gt;.
Its signature is like this:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;nesterovskyBros.progress = function(instance /*, task ... */)&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
where &lt;code&gt;instance&lt;/code&gt; is either &lt;code&gt;Model&lt;/code&gt;, &lt;code&gt;Widget&lt;/code&gt;, &lt;code&gt;JQuery&lt;/code&gt; or
DOM &lt;code&gt;Element&lt;/code&gt;, and &lt;code&gt;task&lt;/code&gt; is one or more deferred objects. This
function shows a progress and returns a &lt;code&gt;Promise&lt;/code&gt; that will hide a progress
when all tasks will be complete. Implementation is trivial, so we quote it here:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;// Fusion of kendo.ui.progress() and $.when().&lt;br /&gt;
scope.progress = function(instance /*, task ... */)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; if (instance instanceof Model)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; instance = instance.owner &amp;&amp; instance.owner();&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; if (instance instanceof Widget)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; instance = instance.element;&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; if (instance &amp;&amp; instance.nodeType)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; instance = $(instance);&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; var id = ns + "-progress"; // "nesterovskyBros-progress";&lt;br /&gt;
&amp;nbsp; var progress = (instance &amp;&amp; instance.data(id)) || 0;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; if (arguments.length &amp;lt; 2)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return progress;&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; var result = $.when.apply(null, [].slice.call(arguments, 1));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; if (instance)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; instance.data(id, ++progress);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kendo.ui.progress(instance, progress &amp;gt; 0);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; result.always(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; progress = instance.data(id) || 0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; instance.data(id, --progress);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kendo.ui.progress(instance, progress &amp;gt;
0);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; return result;&lt;br /&gt;
}; &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
The use is like this:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;nesterovskyBros.progress(element, $.ajax("/service1"), $.ajax("/service2")).then(myFunc);&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
The code can be found at &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/controls.js"&gt; controls.js&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=c96c3810-95d1-46bd-b413-7fac0cdbf509" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,c96c3810-95d1-46bd-b413-7fac0cdbf509.aspx</comments>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Tips and tricks</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=04f31825-657d-470b-9223-bb1e8961fc9d</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,04f31825-657d-470b-9223-bb1e8961fc9d.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:comment>http://www.nesterovsky-bros.com/weblog/CommentView,guid,04f31825-657d-470b-9223-bb1e8961fc9d.aspx</wfw:comment>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=04f31825-657d-470b-9223-bb1e8961fc9d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
While trying to generalize our practices from KendoUI related projects we've participated
so far, we updated <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/controls.js"> control.js</a> -
a small javascript additions to KendoUI.
</p>
        <p>
At present we have defined:
</p>
        <p>
1. An extended model. See <a href="2013/04/03/KendoUIExtendedModel.aspx" rel="bookmark">KendoUI
extended model</a>. 
</p>
        <p>
2. A lightweight user control - a widget to bind a template and a model, and to facilitate
declarative instantiation. See <a href="2013/03/26/KendoUIUserControl.aspx" rel="bookmark">KendoUI
User control</a>. 
</p>
        <p>
3. A reworked version of nesterovskyBros.defineControl() function. 
</p>
        <p style="padding-left: 1em">
          <code>var widgetType = scope.defineControl(<br />
{<br />
   name: widget-name-string,<br />
   model: widget-model-type,<br />
   template: optional-content-template,<br />
   windowOptions: optional-window-options<br />
},<br />
base);</code>
        </p>
        <p>
When <code>optional-content-template</code> is not specified then template is calculated
as following:
</p>
        <p style="padding-left: 1em">
          <code> var template = options.temlate || proto.template || model.temlate;<br /><br />
if (template === undefined) 
<br />
{<br />
  template = scope.template(options.name.toLowerCase() + "-template"); 
<br />
} </code>
        </p>
        <p>
When <code>windowOptions</code> is specified then <code>widgetType.dialog(options)</code> function
is defined. It's used to open dialog based on the specified user control. <code>windowOptions</code> is
passed to <code>kendo.ui.Window</code> constructor. <code>windowOptions.closeOnEscape</code> indicates
whether to close opened dialog on escape.
</p>
        <p>
          <code>widgetType.dialog()</code> returns a <code>kendo.ui.Window</code> instance with
content based on the user control. Window instance contains functions: 
</p>
        <ul>
          <li>
            <code>result()</code> - a <code>$.Deffered</code> for the dialog result, and 
</li>
          <li>
            <code>model()</code> - referring to the user control model. 
</li>
        </ul>
        <p>
 The model instance has functions:
</p>
        <ul>
          <li>
 <code>dialog()</code> referring to the dialog, and 
</li>
          <li>
            <code>result()</code> referring to the dialog result.</li>
        </ul>
        <p>
          <code>widget.dialog()</code> allows all css units in <code>windowOptions.width</code> and <code>windowOptions.height</code> parameters.
</p>
        <p>
          <code>base</code> - is optional user control base. It defaults to <code>nesterovskyBros.ui.UserControl</code>.
</p>
        <p>
4. Adjusted splitter. See <a href="2013/05/14/AdjustKendoUISplitter.aspx" rel="bookmark">Adjust
KendoUI Splitter</a>.
</p>
        <p>
5. Auto resize support.
</p>
        <p>
Layout is often depends on available area. One example is <code>Splitter</code> widget
that recalculates its panes when window or container <code>Splitter</code> is resized.
There are other cases when you would like to adjust layout when a container's
area is changed like: adjust grid, tab, editor or user's control contents.
</p>
        <p>
KendoUI does not provide a solution for this problem, so we have defined our own.
</p>
        <ul>
          <li>
A widget can be marked with <code>class="auto-resize"</code> marker;</li>
          <li>
A widget may define a <code>widgetType.autoResize(element)</code> function that adapts
widget to a new size.</li>
          <li>
A code can call <code>nesterovskyBros.resize(element)</code> function at trigger resizing
of the subtree.</li>
        </ul>
        <p>
To support existing controls we have defined <code>autoResize()</code> function for <code>Grid</code>, <code>Splitter</code>, <code>TabStrip</code>,
and <code>Editor</code> widgets.
</p>
        <p>
To see how auto resizing works, it's best to look into <a href="http://www.nesterovsky-bros.com/download/KendoUI/index.html">index.html</a>, <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates/products.tmpl.html"> products.tmpl.html</a>,
and into the implementation <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/controls.js"> controls.js</a>.
</p>
        <p>
Please note that we consider <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/controls.js"> controls.js</a> as
an addition to KendoUI library. If in the future the library will integrate or implement
similar features we will be happy to start using their API.
</p>
        <p>
See also: <a href="http://www.nesterovsky-bros.com/weblog/2013/07/07/CompileKendoUITemplates.aspx">Compile
KendoUI templates</a>.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=04f31825-657d-470b-9223-bb1e8961fc9d" />
      </body>
      <title>KendoUI controls.js</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,04f31825-657d-470b-9223-bb1e8961fc9d.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/05/18/KendoUIControlsjs.aspx</link>
      <pubDate>Sat, 18 May 2013 10:59:36 GMT</pubDate>
      <description>  &lt;p&gt;
While trying to generalize our practices from KendoUI related projects we've participated
so far, we updated &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/controls.js"&gt; control.js&lt;/a&gt; -
a small javascript additions to KendoUI.
&lt;/p&gt;
&lt;p&gt;
At present we have defined:
&lt;/p&gt;
&lt;p&gt;
1. An extended model. See &lt;a href="2013/04/03/KendoUIExtendedModel.aspx" rel="bookmark"&gt;KendoUI
extended model&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
2. A lightweight user control - a widget to bind a template and a model, and to facilitate
declarative instantiation. See &lt;a href="2013/03/26/KendoUIUserControl.aspx" rel="bookmark"&gt;KendoUI
User control&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
3. A reworked version of nesterovskyBros.defineControl() function. 
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt;var widgetType = scope.defineControl(&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; name: widget-name-string,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; model: widget-model-type,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; template: optional-content-template,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; windowOptions: optional-window-options&lt;br /&gt;
},&lt;br /&gt;
base);&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
When &lt;code&gt;optional-content-template&lt;/code&gt; is not specified then template is calculated
as following:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; var template = options.temlate || proto.template || model.temlate;&lt;br /&gt;
&lt;br /&gt;
if (template === undefined) 
&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; template = scope.template(options.name.toLowerCase() + "-template"); 
&lt;br /&gt;
} &lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
When &lt;code&gt;windowOptions&lt;/code&gt; is specified then &lt;code&gt;widgetType.dialog(options)&lt;/code&gt; function
is defined. It&amp;#39;s used to open dialog based on the specified user control. &lt;code&gt;windowOptions&lt;/code&gt; is
passed to &lt;code&gt;kendo.ui.Window&lt;/code&gt; constructor. &lt;code&gt;windowOptions.closeOnEscape&lt;/code&gt; indicates
whether to close opened dialog on escape.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;widgetType.dialog()&lt;/code&gt; returns a &lt;code&gt;kendo.ui.Window&lt;/code&gt; instance with
content based on the user control. Window instance contains functions: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;result()&lt;/code&gt; - a &lt;code&gt;$.Deffered&lt;/code&gt; for the dialog result, and 
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;model()&lt;/code&gt; - referring to the user control model. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;The model instance has functions:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&amp;nbsp;&lt;code&gt;dialog()&lt;/code&gt; referring to the dialog, and 
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;result()&lt;/code&gt; referring to the dialog result.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;code&gt;widget.dialog()&lt;/code&gt; allows all css units in &lt;code&gt;windowOptions.width&lt;/code&gt; and &lt;code&gt;windowOptions.height&lt;/code&gt; parameters.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;base&lt;/code&gt; - is optional user control base. It defaults to &lt;code&gt;nesterovskyBros.ui.UserControl&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
4. Adjusted splitter. See &lt;a href="2013/05/14/AdjustKendoUISplitter.aspx" rel="bookmark"&gt;Adjust
KendoUI Splitter&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
5. Auto resize support.
&lt;/p&gt;
&lt;p&gt;
Layout is often depends on available area. One example is &lt;code&gt;Splitter&lt;/code&gt; widget
that recalculates its panes when window or container &lt;code&gt;Splitter&lt;/code&gt; is resized.
There are other cases when you would like to adjust layout when a container&amp;#39;s
area is changed like: adjust grid, tab, editor or user&amp;#39;s control contents.
&lt;/p&gt;
&lt;p&gt;
KendoUI does not provide a solution for this problem, so we have defined our own.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
A widget can be marked with &lt;code&gt;class=&amp;quot;auto-resize&amp;quot;&lt;/code&gt; marker;&lt;/li&gt;
&lt;li&gt;
A widget may define a &lt;code&gt;widgetType.autoResize(element)&lt;/code&gt; function that adapts
widget to a new size.&lt;/li&gt;
&lt;li&gt;
A code can call &lt;code&gt;nesterovskyBros.resize(element)&lt;/code&gt; function at trigger resizing
of the subtree.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
To support existing controls we have defined &lt;code&gt;autoResize()&lt;/code&gt; function for &lt;code&gt;Grid&lt;/code&gt;, &lt;code&gt;Splitter&lt;/code&gt;, &lt;code&gt;TabStrip&lt;/code&gt;,
and &lt;code&gt;Editor&lt;/code&gt; widgets.
&lt;/p&gt;
&lt;p&gt;
To see how auto resizing works, it&amp;#39;s best to look into &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/index.html"&gt;index.html&lt;/a&gt;, &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/templates/products.tmpl.html"&gt; products.tmpl.html&lt;/a&gt;,
and into the implementation &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/controls.js"&gt; controls.js&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Please note that we consider &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/controls.js"&gt; controls.js&lt;/a&gt; as
an addition to KendoUI library. If in the future the library will integrate or implement
similar features we will be happy to start using their API.
&lt;/p&gt;
&lt;p&gt;
See also: &lt;a href="http://www.nesterovsky-bros.com/weblog/2013/07/07/CompileKendoUITemplates.aspx"&gt;Compile
KendoUI templates&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=04f31825-657d-470b-9223-bb1e8961fc9d" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,04f31825-657d-470b-9223-bb1e8961fc9d.aspx</comments>
      <category>Announce</category>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Tips and tricks</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=9b30445a-be57-4140-a839-fab46b42c76e</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,9b30445a-be57-4140-a839-fab46b42c76e.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:comment>http://www.nesterovsky-bros.com/weblog/CommentView,guid,9b30445a-be57-4140-a839-fab46b42c76e.aspx</wfw:comment>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=9b30445a-be57-4140-a839-fab46b42c76e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We heavily use kendo.ui.Splitter widget. Unfortunately it has several drawbacks:
</p>
        <ul>
          <li>
you cannot easily configure panes declaratively;</li>
          <li>
you cannot define a pane that takes space according to its content.</li>
        </ul>
        <p>
Although we don't like to patch widgets, in this case we found no better way but
to patch two functions: <code>kendo.ui.Splitter.fn._initPanes</code>, and  <code>kendo.ui.Splitter.fn._resize</code>.
</p>
        <p>
After the fix, splitter markup may look like the following:
</p>
        <p style="padding-left: 1em">
          <code> &lt;div style="height: 100%" data-role="splitter" data-orientation="vertical"&gt;<br />
  &lt;div <strong>data-pane</strong>='{ size: "<strong>auto</strong>",
resizable: false, scrollable: false }'&gt;<br />
    Header with size depending on content.<br />
  &lt;/div&gt;<br />
  &lt;div data-pane='{ resizable: false, scrollable: true }'&gt;<br />
    Body with size equal to a remaining area.<br />
  &lt;/div&gt;<br />
  &lt;div data-pane='{ size: "auto", resizable: false, scrollable: false }'&gt;<br />
    Footer with size depending on content.<br />
  &lt;/div&gt;<br />
&lt;/div&gt;</code>
        </p>
        <p>
Each pane may define a <code>data-pane</code> attribute with pane parameters. A pane
may specify <code>size = "auto"</code> to take space according to its content.
</p>
        <p>
The code can be found at <a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/splitter.js"> splitter.js</a> A
test can be seen at <a href="http://www.nesterovsky-bros.com/download/KendoUI/splitter.html"> splitter.html</a>.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=9b30445a-be57-4140-a839-fab46b42c76e" />
      </body>
      <title>Adjust KendoUI Splitter</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,9b30445a-be57-4140-a839-fab46b42c76e.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/05/14/AdjustKendoUISplitter.aspx</link>
      <pubDate>Tue, 14 May 2013 07:34:59 GMT</pubDate>
      <description>&lt;p&gt;
We heavily use kendo.ui.Splitter widget. Unfortunately it has several drawbacks:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
you cannot easily configure panes declaratively;&lt;/li&gt;
&lt;li&gt;
you cannot define a pane that takes space according to its content.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Although we don&amp;#39;t like to patch widgets, in this case we found no better way but
to patch two functions: &lt;code&gt;kendo.ui.Splitter.fn._initPanes&lt;/code&gt;, and&amp;nbsp; &lt;code&gt;kendo.ui.Splitter.fn._resize&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
After the fix, splitter markup may look like the following:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; &amp;lt;div style=&amp;quot;height: 100%&amp;quot; data-role="splitter" data-orientation="vertical"&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;div &lt;strong&gt;data-pane&lt;/strong&gt;=&amp;#39;{ size: &amp;quot;&lt;strong&gt;auto&lt;/strong&gt;&amp;quot;,
resizable: false, scrollable: false }&amp;#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Header with size depending on content.&lt;br /&gt;
&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;div data-pane='{ resizable: false, scrollable: true }'&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Body with size equal to a remaining area.&lt;br /&gt;
&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;div data-pane='{ size: "auto", resizable: false, scrollable: false }'&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Footer with size depending on content.&lt;br /&gt;
&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/code&gt; 
&lt;/p&gt;
&lt;p&gt;
Each pane may define a &lt;code&gt;data-pane&lt;/code&gt; attribute with pane parameters. A pane
may specify &lt;code&gt;size = &amp;quot;auto&amp;quot;&lt;/code&gt; to take space according to its content.
&lt;/p&gt;
&lt;p&gt;
The code can be found at &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/scripts/api/splitter.js"&gt; splitter.js&lt;/a&gt; A
test can be seen at &lt;a href="http://www.nesterovsky-bros.com/download/KendoUI/splitter.html"&gt; splitter.html&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=9b30445a-be57-4140-a839-fab46b42c76e" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,9b30445a-be57-4140-a839-fab46b42c76e.aspx</comments>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Thinking aloud</category>
      <category>Tips and tricks</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p style="direction: ltr">
Although WCF REST service + JSON is outdated comparing to Web API, there are yet a
lot of such solutions (and probably will appear new ones) that use such "old"
technology. 
</p>
        <p>
One of the crucial points of any web application is an error handler that allows gracefully
resolve server-side exceptions and routes them as JSON objects to the client for further
processing. There are dozen approachesin Internet that solve this issue  (e.g. <a href="http://blog.manglar.com/how-to-provide-custom-json-exceptions-from-as-wcf-service/">http://blog.manglar.com/how-to-provide-custom-json-exceptions-from-as-wcf-service/</a>),
but there is no one that demonstrates error handling ot the client-side. We realize
that it's impossible to write something general that suits for every web application,
but we'd like to show a client-side error handler that utilizes JSON and KendoUI.
</p>
        <p style="direction: ltr">
On our opinion, the successfull error handler must display an understandable error
message on one hand, and on the other hand it has to provide technical info for developers
in order to investigate the exception reason (and to fix it, if need):
</p>
        <table border="0">
          <tr>
            <td style="vertical-align: top;">
              <a href="http://www.nesterovsky-bros.com/images/colapsed-error-dialog.png">
                <img src="http://www.nesterovsky-bros.com/images/thumb-colapsed-error-dialog.png" alt="collapsed error dialog" />
              </a>
            </td>
            <td>
              <a href="http://www.nesterovsky-bros.com/images/expanded-error-dialog.png">
                <img src="http://www.nesterovsky-bros.com/images/thumb-expanded-error-dialog.png" alt="collapsed error dialog" />
              </a>
            </td>
          </tr>
        </table>
        <p>
You may <a href="http://www.nesterovsky-bros.com/download/ErrorHandling.zip">download
demo project here</a>. It contains three crucial parts:
</p>
        <ul>
          <li>
A server-side error handler that catches all exceptions and serializes them as JSON
objects (see <strong>/Code/JsonErrorHandler.cs</strong> and <strong>/Code/JsonWebHttpBehaviour.cs</strong>).</li>
          <li>
An error dialog that's based on user-control defined in previous articles (see <strong>/scripts/controls/error.js</strong>,<strong> /scripts/controls/error.resources.js</strong> and <strong>/scripts/templates/error.tmpl.html</strong>).</li>
          <li>
A client-side error handler that displays errors in user-friendly's manner (see <strong>/scripts/api/api.js</strong>,
method <strong>defaultErrorHandler()</strong>).</li>
        </ul>
        <p>
Of course this is only a draft solution, but it defines a direction for further customizations
in your web applications.
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f" />
      </body>
      <title>Error handling in WCF based web applications</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/05/13/ErrorHandlingInWCFBasedWebApplications.aspx</link>
      <pubDate>Mon, 13 May 2013 23:09:02 GMT</pubDate>
      <description>   &lt;p style="direction: ltr"&gt;
Although WCF REST service + JSON is outdated comparing to Web API, there are yet a
lot of such solutions (and probably will appear new ones) that use such &amp;quot;old&amp;quot;
technology. 
&lt;/p&gt;
&lt;p&gt;
One of the crucial points of any web application is an error handler that allows gracefully
resolve server-side exceptions and routes them as JSON objects to the client for further
processing. There are dozen approachesin Internet that solve this issue&amp;nbsp; (e.g. &lt;a href="http://blog.manglar.com/how-to-provide-custom-json-exceptions-from-as-wcf-service/"&gt;http://blog.manglar.com/how-to-provide-custom-json-exceptions-from-as-wcf-service/&lt;/a&gt;),
but there is no one that demonstrates error handling ot the client-side. We realize
that it&amp;#39;s impossible to write something general that suits for every web application,
but we&amp;#39;d like to show a client-side error handler that utilizes JSON and KendoUI.
&lt;/p&gt;
&lt;p style="direction: ltr"&gt;
On our opinion, the successfull error handler must display an understandable error
message on one hand, and on the other hand it has to provide technical info for developers
in order to investigate the exception reason (and to fix it, if need):
&lt;/p&gt;
&lt;table border="0"&gt;
&lt;tr&gt;
&lt;td style="vertical-align: top;"&gt;
&lt;a href="http://www.nesterovsky-bros.com/images/colapsed-error-dialog.png"&gt; &lt;img src="http://www.nesterovsky-bros.com/images/thumb-colapsed-error-dialog.png" alt="collapsed error dialog" /&gt; &lt;/a&gt; 
&lt;/td&gt;
&lt;td&gt;
&lt;a href="http://www.nesterovsky-bros.com/images/expanded-error-dialog.png"&gt; &lt;img src="http://www.nesterovsky-bros.com/images/thumb-expanded-error-dialog.png" alt="collapsed error dialog" /&gt; &lt;/a&gt; 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;
You may &lt;a href="http://www.nesterovsky-bros.com/download/ErrorHandling.zip"&gt;download
demo project here&lt;/a&gt;. It contains three crucial parts:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
A server-side error handler that catches all exceptions and serializes them as JSON
objects (see &lt;strong&gt;/Code/JsonErrorHandler.cs&lt;/strong&gt; and &lt;strong&gt;/Code/JsonWebHttpBehaviour.cs&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;
An error dialog that&amp;#39;s based on user-control defined in previous articles (see &lt;strong&gt;/scripts/controls/error.js&lt;/strong&gt;,&lt;strong&gt; /scripts/controls/error.resources.js&lt;/strong&gt; and &lt;strong&gt;/scripts/templates/error.tmpl.html&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;
A client-side error handler that displays errors in user-friendly&amp;#39;s manner (see &lt;strong&gt;/scripts/api/api.js&lt;/strong&gt;,
method &lt;strong&gt;defaultErrorHandler()&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Of course this is only a draft solution, but it defines a direction for further customizations
in your web applications.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,3af8fe47-6f58-4e53-b4e8-6ee5a9203c2f.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>javascript</category>
      <category>kendoui</category>
      <category>Tips and tricks</category>
    </item>
    <item>
      <trackback:ping>http://www.nesterovsky-bros.com/weblog/Trackback.aspx?guid=99e6d3c9-5860-4ccf-b565-93b68e434a30</trackback:ping>
      <pingback:server>http://www.nesterovsky-bros.com/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.nesterovsky-bros.com/weblog/PermaLink,guid,99e6d3c9-5860-4ccf-b565-93b68e434a30.aspx</pingback:target>
      <dc:creator>Vladimir Nesterovsky</dc:creator>
      <georss:point>0 0</georss:point>
      <wfw:comment>http://www.nesterovsky-bros.com/weblog/CommentView,guid,99e6d3c9-5860-4ccf-b565-93b68e434a30.aspx</wfw:comment>
      <wfw:commentRss>http://www.nesterovsky-bros.com/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=99e6d3c9-5860-4ccf-b565-93b68e434a30</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We have upgraded KendoUI and have found that kendo window has stopped to size properly.
</p>
        <p>
In the old implementation window set dimensions like this:
</p>
        <p style="padding-left: 1em">
          <code> _dimensions: function() { 
<br />
  ...<br /><strong>  if (options.width) { 
<br />
    wrapper.width(options.width); 
<br />
  } 
<br />
  if (options.height) { 
<br />
    wrapper.height(options.height); 
<br />
  } 
<br />
  </strong>... 
<br />
}</code>
        </p>
        <p>
And here is a new implementation:
</p>
        <p style="padding-left: 1em">
          <code> _dimensions: function() { 
<br />
  ...<br /><strong>  if (options.width) { 
<br />
    wrapper.width(constrain(<span style="color: red">parseInt(options.width,
10)</span>, options.minWidth, options.maxWidth)); 
<br />
  } 
<br />
  if (options.height) { 
<br />
    wrapper.height(constrain(<span style="color: red">parseInt(options.height,
10)</span>, options.minHeight, options.maxHeight)); 
<br />
  } 
<br /></strong>  ...<br />
} </code>
        </p>
        <p>
Thus nothing but pixels are supported. Earlier we often used <code>'em'</code> units
to define dialog sizes. There was no reason to restrict it like this. That's very
unfortunate. 
</p>
        <img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=99e6d3c9-5860-4ccf-b565-93b68e434a30" />
      </body>
      <title>KendoUI Window turned to the worse</title>
      <guid isPermaLink="false">http://www.nesterovsky-bros.com/weblog/PermaLink,guid,99e6d3c9-5860-4ccf-b565-93b68e434a30.aspx</guid>
      <link>http://www.nesterovsky-bros.com/weblog/2013/04/18/KendoUIWindowTurnedToTheWorse.aspx</link>
      <pubDate>Thu, 18 Apr 2013 10:44:24 GMT</pubDate>
      <description>  &lt;p&gt;
We have upgraded KendoUI and have found that kendo window has stopped to size properly.
&lt;/p&gt;
&lt;p&gt;
In the old implementation window set dimensions like this:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; _dimensions: function() { 
&lt;br /&gt;
&amp;nbsp; ...&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; if (options.width) { 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; wrapper.width(options.width); 
&lt;br /&gt;
&amp;nbsp; } 
&lt;br /&gt;
&amp;nbsp; if (options.height) { 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; wrapper.height(options.height); 
&lt;br /&gt;
&amp;nbsp; } 
&lt;br /&gt;
&amp;nbsp; &lt;/strong&gt;... 
&lt;br /&gt;
}&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
And here is a new implementation:
&lt;/p&gt;
&lt;p style="padding-left: 1em"&gt;
&lt;code&gt; _dimensions: function() { 
&lt;br /&gt;
&amp;nbsp; ...&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; if (options.width) { 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; wrapper.width(constrain(&lt;span style="color: red"&gt;parseInt(options.width,
10)&lt;/span&gt;, options.minWidth, options.maxWidth)); 
&lt;br /&gt;
&amp;nbsp; } 
&lt;br /&gt;
&amp;nbsp; if (options.height) { 
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; wrapper.height(constrain(&lt;span style="color: red"&gt;parseInt(options.height,
10)&lt;/span&gt;, options.minHeight, options.maxHeight)); 
&lt;br /&gt;
&amp;nbsp; } 
&lt;br /&gt;
&lt;/strong&gt;&amp;nbsp; ...&lt;br /&gt;
} &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Thus nothing but pixels are supported. Earlier we often used &lt;code&gt;&amp;#39;em&amp;#39;&lt;/code&gt; units
to define dialog sizes. There was no reason to restrict it like this. That&amp;#39;s very
unfortunate. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nesterovsky-bros.com/weblog/aggbug.ashx?id=99e6d3c9-5860-4ccf-b565-93b68e434a30" /&gt;</description>
      <comments>http://www.nesterovsky-bros.com/weblog/CommentView,guid,99e6d3c9-5860-4ccf-b565-93b68e434a30.aspx</comments>
      <category>javascript</category>
      <category>kendoui</category>
    </item>
  </channel>
</rss>