Get Radio button value and update Telerik Paging for refresh presevation
// F12 and debugger showed the structure
$(document).ready(function() {
var rb = $("input[id='rbfilterType']:radio:checked").attr('value');
$("a[href*='TheGrid-page']").each(function(i) {
var h = this.href;
this.href =replaceQueryString(this.href, "filterType",rb);
}
);
}
)
function replaceQueryString(url, param, value) {
var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i");
if (url.match(re))
return url.replace(re, '$1' + param + "=" + value + '$2');
else
return url + '&' + param + "=" + value;
}
Using CSS Scrollbar to replace malfunction Teleric Scrollbar
// find the inner table and add scrollbar heigth to hide v-bar
$(document).ready(function() {
var h = $("#grdTestList table").height();
var h1 = h + 45;
$("#grdTestList").attr("style", "overflow:auto;height:"+h1+"px");
}
)
Refreshing
<input type="button" value="Close and Refresh" onclick="javascript:document.location.reload();" />
<input type="button" value="Close and Refresh" onclick="javascript:Window_onClose();" />
<script type="text/javascript">
function Window_onClose() {
var window = $('#editDialog').data('tWindow');
window.close();
document.getElementById("submit").click();
}
</script>
Modify Telrik UI using jQuery
$(document).ready(function() {
var anof = $("a.fa:contains('Add new record')")
anof.text("Add location");
var anofr = $("a.fra:contains('Add new record')")
anofr.text("Add man");
anofr.mouseup(function(event) { setCookie("pos", event.pageY, 1); });
var pos = getCookie("pos");
if (!isNaN(pos)) scrollTo(0, pos); // maintain scroll position
setCookie("pos", "", 0);
var url = window.location.href;
if (url.indexOf("grd-mode=edit", 0) <= 0) { // edit mode
$("#save").click(function(e) {
e.preventDefault();
});
}
anof.click(function() {
anof[0].href = removeParameter(anof[0].href, "grd-mode")
});
anofr.click(function() {
anofr[0].href = removeParameter(anofr[0].href, "grd-mode")
});
}
)
Blog Archive
-
▼
2012
(34)
-
▼
July
(9)
- Parallel.For vs. Synchronization using ManualReset...
- Implement Asyn WCF using Task in .Net 4.0
- High Performance WPF/WCF
- WPF Prism MVVM using Unity and Mef
- Trading Signals from EMA and RSI
- Interesting javascript code
- State Machine Desing Pattern
- IoC inject data into DropDownListFor
- Using AutoFac IocContainer to inject Log4Net into ...
-
▼
July
(9)
Saturday, July 14, 2012
Interesting javascript code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment