Contents tagged with javascript

  • Working with Kendo UI Templates

    I’m watching the Introduction to Kendo UI course by Keith Burnell on Pluralsight and decided to play around a little bit with templates, which are a pretty powerful feature.  If you’re a server-side web developers, templates should seem pretty familiar to you.  Any ASP or ASP.NET page can be thought of like a template, in which you mix markup and dynamic data expressions.  In this case, the templates are defined in their own script blocks.  There are demos and documentation available; in my case I opted to write something up based on what’s in the Pluralsight course in a JSFiddle. Templates are most valuable when you’re binding some data to them.  The data can be … more

  • Passing Default Parameter Objects in JavaScript

    You can use the jQuery extend() function to elegantly configure your functions to accept a single parameter object, while providing default behavior for any options that are not set.  For instance, imagine you have a simple function that simply says “Hello, World”.  You could code it like this: Now, if you want to start passing in parameters, you can easily do so by parameterizing the method, but every time you do, you break any code that was expecting the original parameterless version.  This can quickly grow out of hand within a few revisions of the function’s signature.  A simple way to avoid this issue and allow for your function to version forward effectively is to … more

  • Wiring Up TimeAgo and ASPNET MVC

    Imagine you want to display something on a page so that instead of raw dates, the user is shown something more relative to the current time.  You’ve probably seen this in some of the applications you use.  “Last Updated: A moment ago” or “about an hour ago”.  There are a variety of ways you can implement this, and it’s been done in many different languages.  In my case, which is an ASP.NET MVC C# application, I considered doing it on the server and simply passing the result as a string to the view for display.  However, in searching for the best way to do this, I stumbled upon the Timeago plugin for jQuery. One of the key benefits of this plugin is that, unlike … more

  • JavaScript The Good Parts Reviewed

    Finished up Douglas Crockford’s JavaScript: The Good Parts this week.  It definitely helped me improve my understanding of JavaScript, which I’ve been using since it was new, but always like a C programmer, and only recently like a JavaScript programmer.  I really appreciated Crockford’s honest, no-holds-barred analysis of JavaScript’s design and language choices.  It had me chuckling more than once.  I also appreciated that the book, at only 150 pages including the index, is devoid of fluff.  There’s just enough repetition between chapters to ensure certain points are made and made well. The book makes frequent use of railroad diagrams, which I’ve seen before but … more