<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Wijmo  &#187;  Topic: Combobox and Knockout</title> <atom:link href="http://wijmo.com/topic/combobox-and-knockout/feed/" rel="self" type="application/rss+xml" /><link>http://wijmo.com/topic/combobox-and-knockout/feed/</link> <description></description> <pubDate></pubDate> <generator>http://bbpress.org/?v=2.0.2</generator> <language>en</language> <item> <guid>http://wijmo.com/topic/combobox-and-knockout/#post-5072</guid><title><![CDATA[Combobox and Knockout]]></title><link>http://wijmo.com/topic/combobox-and-knockout/#post-5072</link> <pubDate>Sat, 26 May 2012 15:53:54 +0000</pubDate> <dc:creator>Mike.Griffin</dc:creator><description> <![CDATA[<p>Can you show us how to bind a combobox to some json data, it would be great if you had one page that bound each control to a viewmodel. I&#8217;m stuck on this and cannot figure it out.</p> ]]> </description> </item> <item> <guid>http://wijmo.com/topic/combobox-and-knockout/#post-5073</guid><title><![CDATA[Reply To: Combobox and Knockout]]></title><link>http://wijmo.com/topic/combobox-and-knockout/#post-5073</link> <pubDate>Sat, 26 May 2012 16:38:28 +0000</pubDate> <dc:creator>Chris Bannon</dc:creator><description> <![CDATA[<p>Check out the demos for binding each widget here <a href="http://wijmo.com/demo/explore/#knockout" rel="nofollow">http://wijmo.com/demo/explore/#knockout</a>|overview</p><p>Click the view source button to see the code. These samples are all in the download too.</p> ]]> </description> </item> <item> <guid>http://wijmo.com/topic/combobox-and-knockout/#post-5074</guid><title><![CDATA[Reply To: Combobox and Knockout]]></title><link>http://wijmo.com/topic/combobox-and-knockout/#post-5074</link> <pubDate>Sat, 26 May 2012 16:56:38 +0000</pubDate> <dc:creator>Mike.Griffin</dc:creator><description> <![CDATA[<p>I feel stupid, I didn&#8217;t even notice the bar on the right that allowed for me to see demo&#8217;s for all the controls, thanks so much !!</p> ]]> </description> </item> <item> <guid>http://wijmo.com/topic/combobox-and-knockout/#post-5075</guid><title><![CDATA[Reply To: Combobox and Knockout]]></title><link>http://wijmo.com/topic/combobox-and-knockout/#post-5075</link> <pubDate>Sat, 26 May 2012 16:59:21 +0000</pubDate> <dc:creator>Mike.Griffin</dc:creator><description> <![CDATA[<p>Okay, quick follow up. If we bind to a combobox do our properties have to be named label and value. I want to display Name and Id, are we hard locked into label/value property names?</p> ]]> </description> </item> <item> <guid>http://wijmo.com/topic/combobox-and-knockout/#post-5076</guid><title><![CDATA[Reply To: Combobox and Knockout]]></title><link>http://wijmo.com/topic/combobox-and-knockout/#post-5076</link> <pubDate>Sat, 26 May 2012 18:23:58 +0000</pubDate> <dc:creator>Mike.Griffin</dc:creator><description> <![CDATA[<p>Interesting, when I called ko.applyBindings() it was taking 45 seconds. I figured out what was going on. I&#8217;m using entityspaces.js, a javascript orm. It has lazyload properties. It seems like your binding code might be looping over every property/method and invoking them during databinding. The ko.wijmo.customBindingFactory is calling ko.toJS() which is causing everything to lazy load. In fact, knockout isn&#8217;t very smart, it will hang on circular references.</p><p>I&#8217;ll go ahead and regenerate and remove the lazy loaded properties because then it&#8217;s very fast. Just be aware that ko.toJS() invokes every method and property, and our lazy load methods are functions that hit the database, just a heads up.</p><p>I&#8217;m building a huge application with wijmo and knockout so I&#8217;ll really be putting it through the paces &#8230;</p> ]]> </description> </item> <item> <guid>http://wijmo.com/topic/combobox-and-knockout/#post-5097</guid><title><![CDATA[Reply To: Combobox and Knockout]]></title><link>http://wijmo.com/topic/combobox-and-knockout/#post-5097</link> <pubDate>Mon, 28 May 2012 11:49:11 +0000</pubDate> <dc:creator>Mike.Griffin</dc:creator><description> <![CDATA[<p>Here&#8217;s a cool little helper routine for binding to wijmo controls that want a label and value. It works correctly if the data is observable or not observable.</p><pre class="brush: js">
var wijmo_binders = {};

wijmo_binders.getLabelValueBindings = function (collection, label, value) {

    var coll, idx, item, list = [];

    coll = ko.utils.unwrapObservable(collection);

    for (idx = 0; idx < coll.length; idx = idx + 1) {
        item = coll[idx];
        list.push({
            "label": ko.utils.unwrapObservable(item[label]),
            "value": ko.utils.unwrapObservable(item[value])
        });
    }

    return list;
};
</pre><p>I use it like this ..</p> </pre><pre class="brush: js">
list = wijmo_binders.getLabelValueBindings(coll, "Name", "TableId");
</pre><p>where "list" is bound as the data: to a combobox. I imagine I'll have more wijmo_binders which is why I created it that way.</p><p>Routines could be built into the controls like this, for instance.</p><pre class="brush: xml">
wijlist: { listItems: list, label: 'Name', value: 'TableId', selectionMode: 'multiple' }">
</pre><p>And internally wijmo use the routine above to pull the label/name out of the collection (list) passed in, just a thought.  Lovin me some wijmo + ko man, good work !</p> ]]> </description> </item> </channel> </rss>
<!-- Served from: wijmo.com @ 2013-05-18 16:56:18 by W3 Total Cache -->