when using shinydashboard library it seems to override the datatable (DT) css so that datatable paging and search boxes are not available. even
options = list(paging = TRUE)
does not render paged tables as it should.
any ideas what is going on?
It should work with shinydashboard. Have you included the argument dom in your call to datatable:
DT::datatable(mydf, options=list(dom='ftp')))
f for filtering, t for the table, p for paging.
Related
I'm trying to find a way to remove the time headers from the kendo scheduler. I've come across a few ways to do it via css, but they tend to leave the scheduler looking a bit "off".
I found some answers in the kendo docs detailing how to do it out of the box with a javascript implementation, but I'm looking for MVC which I can't seem to find any mention of. I've tried and tried to figure out how to do this, but I can't seem to find the appropriate attributes to set.
The kendo MVC wrappers are effectively ASPX/Razor helper functions that generate a javascript implementation. So assuming the javascript solution in the link you provide contains the solution you need, it should be possible to replicate it using the MVC syntax.
Looking at telerik's solution, they manipulate the DOM with javascript in the dataBinding event for Ungrouped and in dataBound for Grouped. You can specify handlers for these events when declaring the scheduler with MVC syntax:
.Events(e => {
e.DataBound("scheduler_dataBound");
e.DataBinding("scheduler_dataBinding");
})
...and then include the implementation of these functions on the page separately (code lifted from the telerik solution):
<script>
function scheduler_dataBound(e) {
var tables = $(".k-scheduler-times .k-scheduler-table");
//Required: remove only last table in dataBound when grouped
tables = tables.last();
var rows = tables.find("tr");
rows.each(function() {
$(this).children("th:last").hide();
}
function scheduler_dataBinding(e) {
var view = this.view();
view.times.hide();
view.timesHeader.hide();
}
</script>
//for hiding time header
$('#schedulerID').find('.k-scheduler-header-wrap').closest('tr').hide()
//for hiding date header
$(".k-scheduler-layout tr:first .k-scheduler-table").find("tr:eq(0)").hide()
I'm trying to get a jqGrid table to keep its current page on a reload. I've found some samples, but they don't seem to work for me. Here's what I'm trying:
grid.setGridParam({datatype:'json'}).trigger('reloadGrid',[{page:currentPage}]);
It refreshes but always redisplays the first page.
To retain the page on a redraw simply use this:
grid.trigger("reloadGrid",[{current:true}]);
As a matter of interest, you can also get the current page using:
var currentPageVar = grid.getGridParam('page');
Addition:
'grid' is defined thus:
var grid = jQuery("#grid");
Which refers to the ID of the grid table in the HTML.
you can use simply this code:
jQuery("#your_id").trigger("reloadGrid");
You can use
grid.trigger("reloadGrid", {page: currentPage, fromServer: true});
or
grid.trigger("reloadGrid", {current: true, fromServer: true});
in case of usage free jqGrid fork. It's important to use forceClientSorting: true together with loadonce: true.
The reason of the problem, which you describe, is the following: jqGrid can display the second page only if it would make local paging. If you use only loadonce: true then jqGrid display always the first page. More then that, the server have to sort the data returned from the server. The option forceClientSorting: true inform free jqGrid to do filtering, sorting and paging locally after loading the data from the server and before displaying the first (or another) page. The option forceClientSorting: true allows to load relatively large set of data from foreign source (which data one can't control), filter the data locally (to display only required subset of data), sort the result and to display the page of resulting data.
You must be looking for this code
$("#jsGrid").jsGrid("loadData");
The following fiddle is using jaydata and kendoui grid MVVM. The data loads nicely but filtering does not work. Why?
Will kendoui and jaydata combination be able to use the kendoui grid grouping functionality any time soon?
http://jsfiddle.net/t316/4n62B/9/
<div id="airportGrid" data-kendo-role="grid" data-kendo-sortable="true" data-kendo-pageable="true" data-kendo-page-size="25" data-kendo-editable="true" data-kendo-filterable="true" data-kendo-columns='["id", "Abbrev", "Name"]' data-kendo-bind="source: airports"></div>
kendo.ns = "kendo-";
$data.service("https://open.jaystack.net/c72e6c4b-27ba-49bb-9321-e167ed03d00b/6494690e-1d5f-418d-adca-0ac515b7b742/api/mydatabase/", function (factory, type) {
var airportDB = factory();
var vm = {airports:airportDB.Airport.asKendoDataSource()};
kendo.bind($('#airportGrid'),vm);
});
Filtering should work, please provide more info. First of all, you should either use initService or use onReady().
Also, please check the network traffic and paste the relevant part here.
If you see our examples with kendo then you can see filtering in action.
http://jaydata.org/examples/?tags=KendoUI
I'm using grid.onBeforeEditCell event to make a one-click YesNoCheckboxCellEditor.
Not sure if this is the best way to do this, but here is the code I created for this:
Slickgrid - One-click checkboxes?
This works fine, but setting the data[] array directly doesn't seem to effect the dataView().
My understanding is that the dataView and data are completely uncoupled, and so when I have a filtered view, my data behind the filtered viewport will be incorrect.
Based on my code snippet, how do I also update the corresponding cell in the dataView ?
(I found the dataView.getItembyId and dataView.updateItem methods but unsure how to use these)
I've also tried: dataView.refresh(), grid.invalidateRow(), grid.render()
BTW, I'm following this example: http://mleibman.github.com/SlickGrid/examples/example-header-row.html
Use the grid.onClick instead of onBeforeEditCell.
See the http://mleibman.github.com/SlickGrid/examples/example7-events.html example.
For example if i have an implementation of my own helper and i don't like the default WebGrid pager, how may i replace it?
Is it possible to Replace MvcGrid Pager to change it to my custom one?
I did search and didn't find any thing, only what i think i need to do is to render my one and append it to current WebGrid table as a table footer using jQuery.
Is there any another more simple way of doing this?
You can disable the pager by setting the mode to numeric and setting numericLinksCount to zero. Ex:
<div id="gridSample">
#( var grid = new WebGrid(rowsPerPage: Model.GridRowsPerPage);
grid.Bind(source: Model.ListData,
rowCount: Model.TotalRowCount,
autoSortAndPage: false)
)
#grid.GetHtml(mode: WebGridPagerModes.Numeric, numericLinksCount: 0)
<!--...custom paging here...-->
</div>
Then you're free to render your own paging links using a combination of rows per page and total row count. (Each link should pass the "page" parameter) Easy once you disable the built-in pager... hope that helps.
You can change the Pager Mode on the WebGrid see WebGridPagerModes
Other than this you can style the pager with CSS.