I'm using Kendo Grid on an existing HTML table which is fine.
I'd like to do other stuff with the data. I've figured out how to get the dataItem for a selected row, but I'd also like to use the entire data source (i.e. the 'converted' HTML items) on the dataBound event.
I'm sure this is pretty simple, I just don't know where to look for the 'raw' data.
Any advice greatly appreciated.
This may not be the 'official' way to access the data, but it works. This is added to the Grid configuration:
dataBound: function(e) {
var data = this.dataSource.options.data;
}
Pretty simple really. Don't know why I couldn't find it sooner.
Related
I have a view where there is a dropdown and datatable.
At initial load, I am loading the values to be loaded in the datatable based on the first select of dropdown and on change of dropdown, I want to fetch data based on that condition and populate those data on the datatable.
Please anyone suggest a way to do this!
I am trying a way using get request but it is reloading the page and hence I am unable to make the data persist in the datatable.
I followed exactly this https://laracasts.com/discuss/channels/laravel/filtering-data-using-drop-down-onchange-event
Data is coming and populates to the datatable but just after a second, it reloads and comes to old data in datatable.
Please either correct my or suggest some new way to do it!
After debugging, I found that in one of the js file included, there were a code
$(document).ajaxStop(function() {
window.location.reload();
});
Since, this code was making it to reload on every ajax call completes, I faced this issue.
I want to freeze the bottom row of my grid. I'm thinking of writting a row attrribute for it. Something like this:
"rowattr": function (rd) {
if (rd.islocked) {
return {"frozen":"true"};
}
}
Will something like this actually work ? I looked at the example here, but it didn't work for me.
This is the first time I'm using Jqgrid, so I hva eno idea how to do this. Any help is welcomed. :)
I suppose, you should just use the footer/summary row of jqGrid. By adding footerrow: true option you will inform jqGrid to create additional "footer row" at the bottom of the grid. To fill the row with data you can either use the method footerData. It's the way manual filling the footer row. Alternatively you can use userdata part of input data (or set userData parameter) and to use userDataOnFooter: true option. In the second way jqGrid will fill the footer using userdata as input.
I want to get sorted list items from bind object using kendo ui sortable listview. please refer the sample code from below.
http://dojo.telerik.com/#lilan123/eWofa/2
One way would be to use the Kendo event that is fired on the move or change of the sortable list to set the new index value of the item in the ng-repeat that was moved.
You set the event in the "k-on-change".
<ol id="sortable" kendo-sortable k-options="sortableOptions" k-on-change="change(kendoEvent)">
Then you add the event to the scope.
$scope.change = function(e) {
console.log(e);
alert("The e object has stuff like the old index:" + e.oldIndex);
//Get the correct item from the bound list based on index and change the index values in the list to match.
}
It seems like a hack, but then again, it always felt like a hack when using Telerik controls.
Here is a good blog post on using the events with angular, and what they claim are best practices. Hope it helps!
I have a grid,
grid = new Slick.Grid("#myGrid", loader.data, columns, options);
How do I get the grid to reload? I'm using a remote model as by the examples as provided by the slickgrid documentation.
I want to force the reload based on clicking a button.
Thanks
I found my problem.
I'm using the remotemodel from Slickgrid's examples. The problem I had was I did not "clear()" the data. The "clear()" function deleted all of the old data it contained. I then invalidated and everything worked.
Telerik Experts, I need your help guys!
In my grid, data gets bound on the client, through .ClientEvents .OnDataBinding.
I just call grid.dataBind(customData). Data gets displayed, but grouping, filtering, sorting don't work. Is it possible to group or filter stuff after grid.dataBind call?
Right now it just moves my columns around and doesn't do any grouping. Sorting and filtering fails also.
Can you show me a simple example of grouping without any server calls please?
You may want to consider using the Operation Mode feature, which was released in the recent Q2 2011 release.
Client operation mode - This new mode allows operations like sorting,
paging, filtering or grouping to be performed purely on the client, by
making a single initial call to the server to retrieve all data.
Client Mode Implementation:
Html.Telerik().Grid(Model)
.Name("YourGrid")
.DataBinding(dataBinding => dataBinding
.Ajax()
.OperationMode(GridOperationMode.Client) // Set to Client
.Select("Select", "Home")
)
Otherwise, to manually group using javascript, as follows:
<script type='text/javascript'>
function yourGrid_onDataBinding(e){
//Grabs your Grid
var yourGrid = $("#yourGrid").data("tGrid");
//Removes any existing groupings
yourGrid.groups = [];
//Ensure the column you wish to group by is EXACTLY as it appears in the Grid
yourGrid.group("yourColumnName");
}
</script>
Here are a few useful threads from the Telerik MVC forum that might help you solve your issue if this isn't a viable solution for you:
Client-Side Grouping | Has a great deal of code for client-side grouping operations
Client-Side dataBinding | More client-side code, talks about ClientSideGroupHeaderTemplates
Grouping with OperationMode.Client | If you have any issues with OperationMode.Client
As I know you couldn't do it without any hit to the server again.
But you can do it by Ajax throw JavaScript.
All you need to do is and these methods will rebind your grid :
// For filtering
grid.filter("propName~eq~youValue");
// For grouping
grid.group("column Title");
And take care this is column title not property name so if your property is "CustomerName" and your column title is "Customer Name" the you should pass the column title.
Anyway this will make an Ajax call to the controller to rebind Grid again.
Update:
Your grid should set .EnableCustomBinding(true) and you should decorate controller method that get your Ajax grid with [GridAction(EnableCustomBinding = true)] Attribute.
Hope this helped
I'm doing the exact same thing in my grid. I'm using 2011.2.629, jQuery 1.6.2. I'm actually doing this for external filtering--so I don't use the built in filtering--but grouping and sorting both work for me.
We need some code, man.
As someone else mentioned, make sure you have the following set:
dataBinding.Ajax().OperationMode(GridOperationMode.Client)
Is your grid bound at runtime? If not, bind it to an empty viewModel that's the same as the one you're using in the dataBind(). Also, how are you binding to the new list? It could be something in your onDataBinding().