<div dir="ltr">Hi,<div><br></div><div>I am using Alpha Menu (People app style sorting) in my app. However it only supports QML ListModel as it's dataSource. I tried doing this:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)"> </span><span style="font-family:arial,sans-serif;color:rgb(128,0,128)">StationsModel</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">{</span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">id</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;font-style:italic;color:rgb(0,0,0)">stationsModel</span><span style="font-family:arial,sans-serif">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ListModel</span><span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">id</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">qmlListModel</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">Component.onCompleted</span>:<span style="color:rgb(192,192,192)"> </span>{<span style="font-style:italic;color:rgb(0,85,175)">console</span>.log(lib.stationCount);<span style="font-style:italic;color:rgb(0,0,0)">fillList</span>()}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">function</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">fillList</span>()<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">var</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(41,133,199)">i</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>0</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(128,128,0)">var</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(41,133,199)">r</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>0;<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(41,133,199)">r</span><span style="color:rgb(192,192,192)"> </span><<span style="color:rgb(192,192,192)"> </span>lib.stationCount;<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(41,133,199)">r</span>++)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">qmlListModel</span>.append({<span style="color:rgb(0,128,0)">"title"</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">stationsModel</span>.get(<span style="font-style:italic;color:rgb(41,133,199)">i</span>).title}) //< line 52</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(41,133,199)">i</span><span style="color:rgb(192,192,192)"> </span>++</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,85,175)">console</span>.log(<span style="font-style:italic;color:rgb(41,133,199)">i</span>)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;white-space:normal"> Well, it isn't working. What's wrong with it? Here's the output:</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[W] unknown:52 - </span><a href="file:///usr/share/harbour-nettiradio/qml/Pages/StationGridView.qml:52"><span style="font-family:Courier;font-size:10pt;color:rgb(0,87,174)">file:///usr/share/harbour-nettiradio/qml/Pages/StationGridView.qml:52</span></a><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">: TypeError: Cannot read property 'title' of undefined</span><span style="font-family:arial,sans-serif;white-space:normal"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;white-space:normal"> "Good night to you, dear devs!" wishes<br>jollailija</span></pre></div></div>