Here is the code I'm using to export Kendo Grid to Excel and for some reason it is not calling the export function. Am I missing something?
http://jsfiddle.net/5wZ3R/9/
$( "#downloadify" ).click(function() {
alert("Export called");
toCSV('gridmaster');
});
I was able to fig it out and here is the output if someone needs to use it.
http://goo.gl/KyzmGZ
Done.
Related
In Visual Studio when I writing large js files a lager help is top drop'n down menu for navigation to functions and other objects.
When I declare jQuery ready function like
$(document).ready(function () { });
Then there is no name for that function in top menu.
I wondering can I construct jQuery function some how different to vs recognize its name.
There is no name displayed because you didn't give one to the function (it's anonymous, which is perfectly OK here).
If you want to have a name in the dropdown, add one like this:
$(document).ready(function onReady() { ... })
In this case, onReady will show up in the dropdown.
The situation is I need to load data for a long time, and I need to show a loading icon when loading, but it seems d3 stop my jquery code. My loading icon only display when the calculateAroundCenter function finished, I think it is because the jquery execute after the d3 scope end.
$("#loadingBox").show()
calculateAroundCenter();
so how to show the icon? Like $.timeout in angularjs, I wish you know this js.
Thanks a lot!
D3 doesn't provide anything for this, but you can easily make your own as follows:
showLoadingIcon();
d3.json(url, function(error, data) {
// do something with the data
removeLoadingIcon();
});
I've used this technique here.
How can I remove a specific tool/button from Kendo Editor control?
Actually, I just want to remove Insert image button from Kendo Editor(all tools) control.
#(Html.Kendo().Editor()
.Name("editor")
.Tools(tools => tools.SubScript().SuperScript().ViewHtml())
)
Any ideas?
Got it. Need to remove all the tools first of all, and then add each tool one by one. There is a method Clear() for it. Here is the code.
#(Html.Kendo().Editor()
.Name(name)
.Tools(tools => tools.Clear() //remove all tools
.Bold().Italic().Underline().Strikethrough()
.FontName().FontSize().FontColor().BackColor()
.JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
.InsertUnorderedList().InsertOrderedList().Indent().Outdent()
.FormatBlock().CreateLink().Unlink()
.SubScript().SuperScript().ViewHtml()
)
Please let me know if there is any other way of doing this.
The other way to remove the specific or all tools is by using jquery, something like this -
<script>
$(document).ready(function() {
$("#editor").kendoEditor({
value: "<p>hello there...</p>",
tools: []
});
});
</script>
and here is the Demo JS Fiddle
I am trying to run a function on page load but its not working. I've added it in every place I can think of and the ONLY thing that works is:
$("html").mousemove(function(event) {
$('#project_thumbs_container').masonry('reload');
});
I've tried delays but I have resorted to the hacky above method :(
Does anyone have any suggestions as to why my function won't run?
UPDATE:
I am using masonry for jquery. My problem is when I load a page that uses masonry with ajax, it shows them in a single column. $('#project_thumbs_container').masonry('reload'); resets it properly, but it only works using the above mousemove method.
It sounds like you have one of two problems:
1) Malformed HTML which is causing an error, which isn't allowing the code to parse correctly when using the document onReady syntax: $(function() { ... });
2) Masonry might be loading asynchronously, which means that the "onReady" callback might not be the one that you want to be using. Your Ajax call would look more like this:
$('body').load('index.html', function() {
$('#project_thumbs_container').masonry();
});
Unless someone has a better answer, I just put the code in my fadeIn(); snippet after ajax call is complete:
this.fadeIn('slow', function() {
$('#project_thumbs_container').masonry('reload');
});
Seems to work.
Try something like this.
$(document).ready(function(){
$('#project_thumbs_container').masonry('reload');
});
You can put this code anywhere on the page and it should work, as long as the dependencies have already been loaded.
Just put your function in this
$(document).ready(function() {
// Handler for .ready() called.
// your function
});
when your page load the function will execute
I'm new to jqgrid. It's may be silly question, but please help me. I want to export data to excel file, and I watch demo on http://www.trirand.net/demoaspnetmvc.aspx , it's already support it.
However I defined grid in Views, not in Model like the demo:
$(document).ready(function () {
jQuery("#list").jqGrid({{
url: '/documents/List',{
datatype: 'json',{
mtype: 'GET',{
......
I wonder if there's a way to call this grid from controller, or how to name and use it like variable?
Thank in advance
You cannot call grid from your controller. Jqgrid extension just renders data on a client in a way you specify it, you have no access to it from server-side code.
If you take closer look on example which you provide, authors pass grid options in request and bind new grid object on server, then export data from this object. You need to do the same.