CHUVASH.eu
  • About
  • Search

Posts

February 9, 2012

Push a copy of Resources to client in javascript

In one of my previous posts I told about pushing a copy of an object into client. Now I’ll try to copy my resource values into client. The problem is often that we must create multiple localization resources: first as resx-file. If we use much ajax and client side rendering, we must provide some localization there, too. If they are different subsets of localization resources, it isn’t a problem. But when you get overlapping, it becomes more difficult to manage and sync them. See how Microsoft Ajax Library provides some strings: What if we just copy the values from resx file into client? If there are not business constraint it can make the development much easier. Let’s try it. For that we need Reflection. We start with changing the access modifiers on resx file to public: Then we must get all static properties of the auto-generated class (ResXFileCodeGenerator):

read more
February 8, 2012

Simple select unselect all

I have a simple html table, every row in tbody has a checkbox. thead has a checkbox. When it is checked/unchecked, all checkboxes have to be selected/ unselected. Here is a very simple javascript to achieve this:

$("#mytable thead :checkbox").live({
  change: function () {
    var checked = $(this).is(":checked");
    $("#mytable tbody :checkbox").attr("checked", checked);
  }
});
read more
February 5, 2012

Simple autocomplete in jQuery UI

Thanks to Justin Cooney and jsfiddle. Here is a simple autocomplete example:

read more
February 5, 2012

Nested templates in jQuery.tmpl

I have used jQuery tmpl for a while and it is really awesome. Now I want to use some nested templates. And the thing is: it is very simple to do it: Here is the code to achieve this:

<div onclick="doo()">test</div>
<div id="container"></div>
<script id="parent-template" type="text/html">
<li>
   {{tmpl t }}
</li>
</script>
<script id="red" type="text/html">
   <span style="color:red">{{= title}}</span>
</script>
<script id="green" type="text/html">
   <span style="color:green">{{= title}}</span>
</script>
<script type="text/javascript">
    var d = \[\];
    d.push({ title: "one", t: "red" });
    d.push({ title: "two", t: "green" });
    $.template("red", $("#red").template());
    $.template("green", $("#green").template());
    function doo() {
        $("#parent-template").tmpl(d).appendTo("#container");
    }
</script>
read more
February 5, 2012

jQuery: select elements with a specific text

There are situations when you want to select only dom elements which only have a specific content. jQuery provides a beautiful selector :contains:

$("a:contains(Pages)")
```But what if it isn't enough to just get all the elements which contain some word? Let's check what we get if we traverse all anchors on http://sv.wikipedia.org containing "wiki":

$(“a:contains(wiki)”).each(function(i) { console.log($(this).text()); });

[![](https://sharepointkunskap.files.wordpress.com/2012/02/jquery-contains-wiki.png "jquery-contains-wiki")](https://sharepointkunskap.files.wordpress.com/2012/02/jquery-contains-wiki.png) There is another, a generic way, to filter out elements, and it is called "filter". So a little regex check will do the trick.

$(“a”).filter(function() { return /look_for/i.test($(this).text()); }

read more
February 2, 2012

Knockout.js!

[youtube http://www.youtube.com/watch?v=DnhGqcKEPiM&w=640&h=360] See an example what you can with it SharePoint, written by Thorsten Hans.

read more
February 2, 2012

Add links to Global Navigation in My Sites

Oliver Wirkus shows how to add links to Global Navigation in My Sites. Just go to: Central Administration Applicaiton Management Manage Service Applications User Profile Service Application Configure Personalization Site

Comments from Wordpress.com

Lroth - Feb 4, 2015

There is no “configure personalization site” link. What is in the tea you are drinking?

It is actually coffee…Just kidding. This is an instruction for SharePoint 2010.

read more
January 26, 2012

jQuery UI tabs maries sharepoint webparts

jQuery UI tabs maries sharepoint webparts

read more
January 25, 2012

Enable cookies in Page Viewer WP

Enable cookies in Page Viewer WP

read more
January 24, 2012

Parameterize a javascript object and create url

If you want to add some parameters to an url which you want to open, you can use jQuery.param function:

var url = "some\_url";
var params = { 
   name: "Setner",
   email: "setner@narspi.name",
   mobile: "123456789"
};
var search = "?" + $.param(p);
url += search;
```It is handy, indeed. In an environment without jQuery (are there some?:) ) you can just iterate an object and join properties:

var url = “some_url”; var params = { name: “Setner”, email: “setner@narspi.name”, mobile: “123456789” }; if (url.match("/\?/g") == null) { url += “?”; } else { url += “&”; } var search = “”; for(var p in params) { search += [p, params[p]].join("="); } url += search;

read more
  • ««
  • «
  • 25
  • 26
  • 27
  • 28
  • 29
  • »
  • »»
© CHUVASH.eu 2026