1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

issue with c:sort!

Discussion in 'Census: Planetside 2' started by shinigai, Mar 19, 2013.

  1. shinigai

    shinigai Guest

    as the title says I am having a hell of a time sorting I am trying to sort it by the "value" which is kills from biggest to smallest this is what I am using and it doesnt have any kind of effect at all <img src="/smilies/9d71f0541cff0a302a0309c5079e8dee.gif" border="0" alt="SMILEY" />

    http://census.daybreakgames.com/get/ps2-beta/....kills.weapon:1

     
  2. Dedith

    Dedith Guest

    I believe c:sort is to sort the collection objects returned (character_list in this case), not the data within.

    For php, I suggest:

    foreach (sort($data['character_list'][0]['stats']['kills']['weapon']<span ><code>) as $weaponId => $killData) {</code>

    <span ><code>}</code>

    <span ><code>If in javascript, it's a lil different due to that part being an object.  Let me know, I found code to extract the keys of an object into an array which is then sortable.</code>

    <span ><code>$.each(Object.keys(data.character_list[0].stats.kills.weapon).sort(), function (idx, weaponId) {</code>

    <span ><code>// access data then with: data.character_list[0].stats.kills.weapon[weaponId]</code>

    <span ><code>});</code>

     
  3. feldon30

    feldon30 Guest

    What he said. ;)

    For sorting an array by its keys, I like natcasesort(). It's slower, but you get much more expected results:

    12379101117118AlphaapocBasebell

    vs. sort():

    11011118172379AlphaBaseapocbell

     

Share This Page