Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Filter in a ListGrid inside of a SelectItem

    Hello, we have a problem:

    We have a ListGrid component inside of a SelectItem with filter posibility. The problem is when we press the RETURN key, it selects the first list element. My question is: is there somehow of disable the RETURN key in the filter element?

    note: the "filterOnkeyPress" property of the SelectItem component must be false.

    thanks
    Last edited by josemar7; 13 Mar 2013, 23:33.

    #2
    How did you put a ListGrid inside of a SelectItem? Probably that's not what you mean.

    Comment


      #3
      Thanks for answer,

      I have this SelectList:

      {ID:"prConceptoNominaHoraNormal", name: "conceptoNominaHoraNormal", editorType: "MpxSelectItem", required: false, endRow:true,
      emptyDisplayValue: isc.Mpxi18nProperties.defaultValuePayslipConcept,
      canSort: true,
      optionDataSource: "payslipConceptDS",
      displayField:"descripcionAbreviada", valueField:"codigo",
      pickListWidth:470,
      getDefaultFilter: function(filter) {
      filter = this.Super("getDefaultFilter", filter);
      filter["activo"] = true;
      return filter;
      },
      pickListFields:[
      {name:"codigo", width: 50, align:"center", canSort: true},
      {name:"descripcionAbreviada", width: 150, canFilter: false, canSort: false},
      {name:"descripcion", width: 250, canSort: true}
      ]
      },


      where MpxSelectItem is a defined class. The content is:

      // Clase MpxSelectItem

      isc.ClassFactory.defineClass("MpxSelectItem", "SelectItem");
      isc.MpxSelectItemObj = isc.MpxSelectItem.getPrototype();

      isc.MpxSelectItemObj.dataPageSize = isc.MpxGeneralProperties.dataPageSize;

      isc.MpxSelectItemObj.canSort = true;

      isc.MpxSelectItemObj.canMultiSort = true;

      isc.MpxSelectItemObj.filterCallback = undefined;

      isc.MpxSelectItemObj.showFilter = true;

      isc.MpxSelectItemObj.canGroupBy = false;

      isc.AllFuncs = isc._allFuncs;

      isc.AllFuncs.push(
      isc.MpxSelectItemObj.init = function isc_MpxSelectItemObj_init() {
      var objThis = this;
      this.Super("init",arguments);

      this.autoDraw = false;
      this.autoFetchData = false;
      this.titleAlign = "left";
      this.vertical = false;
      this.wrapTitle = false;

      if (this.optionFilterContext == undefined) {
      this.optionFilterContext = {data: objThis.getFilter()};
      }

      this.pickListProperties = {dataPageSize: isc.MpxGeneralProperties.dataPageSize};

      this.pickListProperties["canSort"] = objThis.canSort;

      if (objThis.canSort == true) {
      this.pickListProperties["sort"] = function(sortField, sortDirection) {
      var sortSpecifiers = {direction: sortDirection, primarySort: true, sortIndex: 0, property: objThis.pickListFields[sortField].name};
      objThis.applyQuery(this.getFilterEditorCriteria(), objThis.filterCallback, [sortSpecifiers], this.getGroupByFields());
      };
      this.pickListProperties["sortChanged"] = function(sortSpecifiers) {
      objThis.applyQuery(this.getFilterEditorCriteria(), objThis.filterCallback, sortSpecifiers, this.getGroupByFields());
      };
      }

      if (objThis.showFilter == true) {
      this.pickListProperties["showFilterEditor"] = true;
      this.pickListProperties["canResizeFields"] = true;
      this.pickListProperties["filterByCell"] = false;
      this.pickListProperties["filterOnKeypress"] = false;
      this.pickListProperties["filterData"] = function(criteria, callback, requestProperties) {
      var argumentsToPass = [];
      var filter = objThis.getFilter(criteria, this.getSort(), this.getGroupByFields());
      if (arguments.length == 0) {
      argumentsToPass[0] = filter;
      }
      else {
      argumentsToPass = [filter, callback, requestProperties];
      }
      this.Super("filterData", argumentsToPass);
      };
      }

      if (objThis.canGroupBy == true) {
      objThis.pickListProperties["groupBy"] = function(groupCriteria) {
      objThis.applyQuery(this.getFilterEditorCriteria(), objThis.filterCallback, this.getSort(), groupCriteria);
      };
      }
      },

      isc.MpxSelectItemObj.applyQuery = function isc_MpxSelectItemObj_applyQuery(filter, callback, sortingSpecifiers, groupBySpecifiers) {
      filter = this.getFilter(filter, sortingSpecifiers, groupBySpecifiers);
      this.pickList.filterData(filter);
      },

      isc.MpxSelectItemObj.getFilter = function isc_MpxSelectItemObj_getFilter(filter, sortingSpecifiers, groupBySpecifiers) {
      filter = this.getDefaultFilter(filter);

      if (this.dataPageSize != undefined) { //añadimos la paginación
      if (filter.pageSize == undefined) { //nos aseguramos de que no machacamos la información que pueda ir ya de paginación
      filter["pageSize"] = this.dataPageSize;
      }
      }

      if (sortingSpecifiers != undefined) {
      filter["sortSpecifier"] = sortingSpecifiers;
      }

      if (groupBySpecifiers != undefined) {
      filter["groupBy"] = groupBySpecifiers;
      }

      return filter;
      },

      isc.MpxSelectItemObj.getDefaultFilter = function isc_MpxSelectItemObj_getDefaultFilter(filter) {
      if (filter == undefined) {
      filter = {};
      }
      return filter;
      }
      );

      Comment


        #4
        It looks like you copied obfuscated code from the framework and tried to modify it. Never, ever do this - your code is full of internals and unsupported usage. See the QuickStart on how to create custom classes and revise your code to match the techniques discussed.

        Comment

        Working...
        X