title: Why does this datagrid sort in a weird order?
body: <p>I have a datagrid where each row has a column where I have defined a formatter to format the display result depending on what it says in the database and create a <code>div</code> with a background color depending on the database.</p>
  
  <p>I have this structure for my datagrid:</p>
  
  <pre><code>structure: [
    {
      name: "Name",
      field: "name",
      width: "auto"
    },
    {
      name: "Initials",
      field: "initials"
    },
    {
      name: "E-mail",
      field: "email",
      width: "auto"
    },
    {
      name: "Kerberos",
      field: "kerberos",
      width: "120px",
      formatter: function(kerberos){
        var format = "";
  
        if(kerberos == "password expired" || kerberos == "account expired"){
          format = '&lt;div class="yellow" title="'+kerberos+'"&gt;'+kerberos+'&lt;/div&gt;';
        }else if(kerberos == "ok"){
          format = '&lt;div class="green" title="'+kerberos+'"&gt;'+kerberos+'&lt;/div&gt;';
        }else{
          format = '&lt;div class="red" title="Has no kerberos account"&gt;not available&lt;/div&gt;';
        }
  
        return format;
      }
  },
  </code></pre>
  
  <p>When I press the column header to sort, it sorts the rows, put not consistent, so I don't know if it sorts correctly (see image below). How do I define the way the datagrid have to sort this column?</p>
  
  <p><img src="https://i.stack.imgur.com/M7erp.jpg" alt="How it sorts"></p>
  
  <p>I was thinking it was the HTML <code>&lt;div...&gt;</code> part I do in the formatter due to the <code>&lt;&gt;</code> characters, but it still sorts weird if I only output the text (which by my understanding, should be sorted alphabetically). Does anyone know why this happens and how I can fix it?</p>
  
  <p><strong><em>EDIT:</em></strong>
  forgot to add how i get/assign data. I get a lot of data from a xhr.post in JSON format, then i do as follows:</p>
  
  <pre><code>dojo.xhr.post({
      url: "/cgi-bin/users.cgi",
      handleAs: "json",
      content: {
        psearch: "dojoXhrBlank"
      },
      load: function(jsondata){
        // Creating a store for the datagrid
        var personStore = new Memory({ data: jsondata });
  
        // Create datastore for datagrid
        var gridStore = ObjectStore({objectStore: personStore});
        ...
  </code></pre>