jqGrid client-side searching

You should implement search for single field in a little another way: var grid = jQuery(“#Grid2″); var postdata = grid.jqGrid(‘getGridParam’,’postData’); jQuery.extend (postdata, {filters:”, searchField: ‘error_column’, searchOper: ‘eq’, searchString: ‘Test’}); grid.jqGrid(‘setGridParam’, { search: true, postData: postdata }); grid.trigger(“reloadGrid”,[{page:1}]); You can see live example here. UPDATED: You use loadonce: true and datatype: “local” together. The value loadonce: … Read more

Single Page Application: advantages and disadvantages [closed]

Let’s look at one of the most popular SPA sites, GMail. 1. SPA is extremely good for very responsive sites: Server-side rendering is not as hard as it used to be with simple techniques like keeping a #hash in the URL, or more recently HTML5 pushState. With this approach the exact state of the web … Read more

Is it possible to check dimensions of image before uploading?

You could check them before submitting form: window.URL = window.URL || window.webkitURL; $(“form”).submit( function( e ) { var form = this; e.preventDefault(); //Stop the submit for now //Replace with your selector to find the file input in your form var fileInput = $(this).find(“input[type=file]”)[0], file = fileInput.files && fileInput.files[0]; if( file ) { var img = … Read more

How to get client date and time in ASP.NET?

I like the idea of either using the browser/system time and time zone or letting them select their time zone. In a past project I used something like this: <script language=”javascript”> function checkClientTimeZone() { // Set the client time zone var dt = new Date(); SetCookieCrumb(“ClientDateTime”, dt.toString()); var tz = -dt.getTimezoneOffset(); SetCookieCrumb(“ClientTimeZone”, tz.toString()); // Expire … Read more

ASP.NET MVC 3 client-side validation with parameters

You could use the ValidationParameters property to add custom parameters to the rule: public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { var rule = new ModelClientValidationRule { ErrorMessage = this.ErrorMessage, ValidationType = “futuredate”, }; rule.ValidationParameters.Add(“param1”, “value1”); rule.ValidationParameters.Add(“param2”, “value2”); yield return rule; } which could be used in the adapter: jQuery.validator.unobtrusive.adapters.add( ‘futuredate’, [ ‘param1’, ‘param2’ ], function … Read more

In IndexedDB, is there a way to make a sorted compound query?

The term compound query as used in this answer refers to an SQL SELECT statement involving more than one condition in its WHERE clause. Although such queries are not mentioned in the indexedDB specification, you can approximate the behavior of a compound query by creating an index with a keypath that consists of an array … Read more