jqGrid custom pager search button - jqgrid

We have our custom button that is ASP.NET custom server control. We use it on all our pages for action buttons (< NS:OurButton ID='btn' runat="server" Text="Search"/ >).
Now we want to use that button to open our custom search form to filter the records in jqGrid.
Our business requirement that the search button must be a part of jqGrid pager.
How I can do it? I tried to search google and wiki help for jqGrid, but didn't found any way how to add that custom search button to the jqGrid pager.
If it's matters, the button rendered to the client in that markup:
<div id="btn" class="OurCustomButton">
<div class="LeftSide"></div>
<div class="ButtonContent">Search</div>
<div class="RightSide"></div>
</div>
Or maybe it's possible to create totally my own custom pager, with my own design and buttons and then to tell the jqGrid to use it's controls as triggers or to trigger events on my own with correct parameters?

One solution I can think of is to use jQuery's insertBefore()(or insertAfter) and have the html for your button inserted on the document.ready() event.
The code could be:
jQuery(document).ready(function(){
$('<div class="ButtonContent">Search</div>').insertBefore('.RightSide');
});

Related

kendo grid column: how to data bind click event in footer template?

Kendo Grid columns' data-bind click event in the footer template is not working.
Please see the example http://dojo.telerik.com/ALAZo
The click event on column template for price is working fine but not for the footer template for the same.
Any resolution which uses MVVM binding would be greatly appreciated
By default, the header and footer of the Grid are not bound to the ViewModel. A workaround is to find the footer with an appropriate jquery selector after the grid has been initialised and then bind it manually. So something like this:
kendo.bind($("body"), viewModel);
kendo.bind($("#grid").find(".k-grid-footer"), viewModel);
Here I've added id="grid" to your grid declaration like so in order to find it:
<div id="grid" data-role="grid" data-bind="source:dataSource"
I have reworked your example in order to get a solution where click event works on both column and footer template.
<a onclick='test()'... seems to do the trick.

How to get a DropDownList select action to trigger submit button in MVC 4?

I have a DropDownList in an MVC 4 web application that is used as a filter. When a new value is selected from the drop down, the user then has to click the submit button. Is there a way to get the DropDownList to perform the same submit action when a new item is selected from the drop down so I can eliminate the submit button altogether? No custom methods have been written for the submit button, I am just using the generic one that is in MVC.
Update: Code is as follows:
#Html.DropDownList("userName",Model.Users) <input type="submit" value="Search" />
<select name="dropdown" id="dropdown" onchange="this.form.submit()">
p.s. first link in Google search results
Edit
#Html.DropDownList("userName",Model.Users new {onchange="this.form.submit()"})

Reinitialize jquery-mobile after inserting a form into the page

I'm inserting a form via ajax dynamically into the page. After inserting it into the dom tree, i would like to reinitialize the jquery mobile to style the form. I had a look into http://jquerymobile.com/test/docs/api/events.html but since the documentation is pretty unhelpful for jquery mobile I'm not able to find the correct event.
After you have added the form to the DOM, use .trigger('create'); on the form to initialize any widgets (form elements) you've just added:
...html('<form><input data-role="slider" type="text" /><input type="button" value="button" /></form>').trigger('create');
Here is a demo: http://jsfiddle.net/TBRXk/

How to use jQuery UI tabs to load external div via ajax

I'm using the Jquery UI tabs functionality to load content via ajax. I'd like to load a particular div in the ajax call, not the entire page. Is this possible without using jQuery's load()?
As you can see from the code, it's a stock standard basic jQuery tabs implementation, but I want a particular div rather than the full page.
Here's my html:
<div id="tabs">
<ul>
<li>Tab One</li>
<li>Tab Two</li>
<li>Ajax tab</li>
</ul>
<div id="tab-1>Tab one content</div>
<div id="tab-2>Tab two content</div>
</div>
And the inline script:
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
Anyone know if this is possible?
Nathan.
Yes, it is possible. Use jQuery ajax "load" function. Example:
$('#result').load('ajax/test.html #container');
For your 3rd tab you should manually load content via ajax call, also you can define selector which exactly part of loaded page you need. So, create 3rd tab as via general way, load page content for 3rd tab and create tabs. Or you can dynamically load 3rd tab's content when the user clicks on tab.
More information here: http://api.jquery.com/load/, please see paragraph "Loading Page Fragments".

Is it possible to add tooltip the expand/collapse button from the jQGrid header?

Is it possible to add tooltip to the expand/collapse button oJQGrid so that it can change when expanded and vice versa ...
You need to see the documentation for the control but if not i just inspect it and collapse button html is
<span class="ui-icon ui-icon-circle-triangle-n"></span>
and expand is
<span class="ui-icon ui-icon-circle-triangle-s"></span>
so you can get the element by jquery and append what ever kind of html elements you want

Resources