Open caitu opened 10 years ago
6pac sorry for the inconvenience i tried in stack overflow but no use and you are asking for sample code here it is my sample code can you please help me $(function () { var jqxhr = $.getJSON('http://localhost:50305/Service1.svc/json/EmployeeDetails', function (data) { //console.log(data); dataView = new Slick.Data.DataView();
dataView.setItems(data, "EmpId");
// console.log(dataView);
dataView.setPagingOptions({ pageSize: 5 });
grid = new Slick.Grid("#teamGrid", dataView.rows, columns, options);
var pager = new Slick.Controls.Pager(dataView, grid, $("#pager"));
dataView.onPagingInfoChanged.subscribe(function (e, pagingInfo) { var isLastPage = pagingInfo.pageNum == pagingInfo.totalPages - 1; var enableAddRow = isLastPage || pagingInfo.pageSize == 0; var options = grid.getOptions();
if (options.enableAddRow != enableAddRow) {
grid.setOptions({ enableAddRow: enableAddRow });
}
});
dataView.onRowCountChanged.subscribe(function (args) {
grid.updateRowCount();
grid.render();
});
grid.onSort.subscribe(function (e, args) { console.log(args.sortCol);
gridSorter(args.sortCol,args.sortAsc, dataView);
});
function gridSorter(sortCols, isAsc, dataview) {
dataview.sort(function (row1, row2) {
for (var i = 0, l = 1; i < l; i++) {
var field = sortCols.field;
var sign = isAsc ? 1 : -1;
var x = row1[field], y = row2[field];
var a = parseInt(x), b = parseInt(y);
var result = (a < b ? -1 : (a > b ? 1 : 0)) * sign;
if (result != 0) {
return result;
}
}
return 0;
}, true);
}
dataView.onRowsChanged.subscribe(function (e, args) {
grid.invalidateAllRows();
// grid.invalidateRows(args.rows);
grid.render();
});
}); });
But in slick.pager.js some of dataview functions are not recognising i cant understand the problem(some of those are dataView.setRefreshHints, dataView.setPagingOptions({pageSize: n});)
Had you got any reasons to pass dataView.rows to Slick.Grid instead of dataView?
On Thu, Sep 4, 2014 at 10:58 AM, caitu notifications@github.com wrote:
6pac sorry for the inconvenience i tried in stack overflow but no use and you are asking for sample code here it is my sample code can you please help me
var jqxhr = $.getJSON(' http://localhost:50305/Service1.svc/json/EmployeeDetails', function (data) { //console.log(data); dataView = new Slick.Data.DataView();
dataView.setItems(data, "EmpId"); // console.log(dataView); dataView.setPagingOptions({ pageSize: 5 }); grid = new Slick.Grid("#teamGrid", dataView.rows, columns, options); var pager = new Slick.Controls.Pager(dataView, grid, $("#pager"));
But in slick.pager.js some of dataview functions are not recognising i cant understand the problem(some of those are dataView.setRefreshHints, dataView.setPagingOptions({pageSize: n});)
— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/1006#issuecomment-54417834.
If iam passing dataview, data is not binding to grid
Put your setItems call into "dataView.beginUpdate(); dataView.endUpdate();"-block
On Thu, Sep 4, 2014 at 11:07 AM, caitu notifications@github.com wrote:
If iam passing dataview, data is not binding to grid
— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/1006#issuecomment-54419122.
https://github.com/mleibman/SlickGrid/wiki/DataView, Batching updates section
On Thu, Sep 4, 2014 at 11:11 AM, Leo Berman ldmberman@gmail.com wrote:
Put your setItems call into "dataView.beginUpdate(); dataView.endUpdate();"-block
On Thu, Sep 4, 2014 at 11:07 AM, caitu notifications@github.com wrote:
If iam passing dataview, data is not binding to grid
— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/1006#issuecomment-54419122 .
Thanks for giving reply. I tried what you said but its not working i got the same error
Sorting is working nicely but problem with paging only
the code you posted doesn't make any sense to me. for example, an unclosed function. has the site mangled your code? you need to post it in a code block. you can edit your post.
And update your code please with suggested changes.
On Thu, Sep 4, 2014 at 11:20 AM, 6pac notifications@github.com wrote:
the code you posted doesn't make any sense to me. for example, an unclosed function. has the site mangled your code? you need to post it in a code block. you can edit your post.
— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/1006#issuecomment-54420939.
or link to your StackOverflow post and continue the discussion there
caitu, it is ridiculous asking for help when (a) there are example pages provided that do what you want and work, so it's clearly a problem with your code, not a SlickGrid bug, and (b) you have provided no sample of your code, browser type, a jsfiddle, or anything else. GitHub is for bug reports. If you have a usage question, go to StackOverflow or progressively modify one of the sample pages.