3
Vote

Grid date datatype sorting and filtering errors

description

After upgrade to version 2011.Q2.712 the next problems appear (Grid in ajax mode):
  1. Trying to filter by date type column throws the following exception "Microsoft JScript runtime error: Object doesn't support property or method 'indexOf'" in file telerik.grid.filtering.min.js in the next part of code: "if(h.indexOf("Date(")>-1)" (col 7121)
  2. Wheh sort mode of grid is:
    .Sortable(sorting => sorting
    .SortMode(GridSortMode.MultipleColumn)
    .OrderBy(sortOrder => sortOrder.Add(t => t.Id).Descending()))"
    all date type columns of grid cannot be sorted. When sortmode is single column - all works.

file attachments

comments

jaxjax wrote Oct 19, 2011 at 1:18 PM

I see the same for 2011.2.712 when filtering DateTime type columns in Ajax bound grid. Please help !

wrote Nov 10, 2011 at 4:06 PM

stefh wrote Nov 10, 2011 at 4:07 PM

Replace this:
case"Date":var i;if(h.indexOf("Date(")>-1){i=new Date(parseInt(h.replace(/^\/Date((.*?))\/$/,"$1")))}else{i=b.datetime.parse({value:h,format:f(g)}).toDate()}return"datetime'"+b.formatString("{0:yyyy-MM-ddTHH-mm-ss}",i)+"'"}return h}

By this:
case "Date": var i; /alert('h = ' + h);/ if (!(h instanceof Date) && h.indexOf("Date(") > -1) { i = new Date(parseInt(h.replace(/^\/Date((.*?))\/$/, "$1"))); /alert('if:' + i);/ } else { (h instanceof Date) ? i = h : i = b.datetime.parse({ value: h, format: f(g) }).toDate(); /alert('else:' + i);/ } var returnValue = "datetime'" + b.formatString("{0:yyyy-MM-ddTHH-mm-ss}", i) + "'"; /alert('returnValue=' + returnValue);/ return returnValue;} return h }

It works in my application. Please test !

stefh wrote Nov 11, 2011 at 7:27 AM

jaxjax wrote Nov 11, 2011 at 12:39 PM

That works for the filtering, great !
  • But after applying the filter I get an error: "Microsoft JScript runtime error: Object doesn't support this property or method" when changing page on the grid, Studio highlights this "var aY=ax.substr(aO).match(a0)". I belive it's in the the telerik.common.min.js

wrote Feb 21, 2013 at 10:58 PM