流星搜索结果清晰

时间:2015-11-05 14:03:26

标签: meteor

我想让Meteor清楚最后的查询,它不会累积我的研究。如果我在输入“NºPatrimónio”中搜索然后再在“CódigoInformática”中搜索,我想清除第一个查询结果。发生的事情是它汇集了第一个和第二个查询结果。总结一下,我想独立查询结果。Meteor search page

模板

statusCriteria = statusCriteria.orOperator(criterias.toArray(new Criteria[criterias.size()]));

辅助

<tbody>
      <tr>
        <th>Nº Património</th>
        <th>Equipamento</th>
        <th>Utilizador</th>
        <th>Nº Helpdesk</th>
        <th>Data Aquisição</th>
        <th>Data Saída</th>
        <th>Ultima Alteração</th>
      </tr>
      {{#each pesquisaEquipamentos}}
      <tr>
        <td>
          {{npatrimonio}}
        </td>
        <td>
          {{equipamento}}
        </td>
        <td>
          {{utilizadores}}
        </td>
        <td>
          {{helpdesk}}
        </td>
        <td>
          {{daquisicao}}
        </td>
        <td>
          {{dsaida}}
        </td>
        <td>
          {{createdAt}}
        </td>
      </tr>
    {{/each}}
</tbody>

公开

if (Meteor.isClient) {

  Template.pesquisar.helpers({
    pesquisaEquipamentos: function() {
      return Equipamentos.find();
    }
  });

  Template.pesquisar.events({

    "keypress input": function(event, template) {
      if (event.keyCode == 13) {
        var search = {};
        search.value = event.target.value
        search.name = event.target.name
        //console.log(search.name, search.value);
        Meteor.subscribe("pesquisaEquipamentos", search);
        event.target.value = '';
      }
    }
  });
}

1 个答案:

答案 0 :(得分:1)

尝试在再次调用之前停止订阅:

{
    "json": {
        "data": {
            "updated": {
                "$t": "04 Nov 2015 2321 GMT"
            },
            "flux": {
                "$t": "111"
            },
            "aindex": {
                "$t": "41"
            },
            "kindex": {
                "$t": "3"
            },
            "kindexnt": {
                "$t": "No Report"
            },
            "xray": {
                "$t": "B6.0"
            },
            "sunspots": {
                "$t": "95"
            },
            "heliumline": {
                "$t": "131.8"
            },
            "protonflux": {
                "$t": "3.14e-01"
            },
            "electonflux": {
                "$t": "5.46e+02"
            },
            "aurora": {
                "$t": "1"
            },
            "normalization": {
                "$t": "1.99"
            },
            "latdegree": {
                "$t": "67.5"
            },
            "solarwind": {
                "$t": "564.3"
            },
            "magneticfield": {
                "$t": "0.2"
            },
            "calculatedconditions": {
                "band": [
                    {
                        "name": "80m-40m",
                        "time": "day",
                        "$t": "Poor"
                    },
                    {
                        "name": "30m-20m",
                        "time": "day",
                        "$t": "Good"
                    },
                    {
                        "name": "17m-15m",
                        "time": "day",
                        "$t": "Fair"
                    },
                    {
                        "name": "12m-10m",
                        "time": "day",
                        "$t": "Poor"
                    },
                    {
                        "name": "80m-40m",
                        "time": "night",
                        "$t": "Fair"
                    },
                    {
                        "name": "30m-20m",
                        "time": "night",
                        "$t": "Good"
                    },
                    {
                        "name": "17m-15m",
                        "time": "night",
                        "$t": "Fair"
                    },
                    {
                        "name": "12m-10m",
                        "time": "night",
                        "$t": "Poor"
                    }
                ]
            }
        }
    }
}