Author Topic: Filter textbox losing focus on double click in ie browser.  (Read 4463 times)

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
Filter textbox losing focus on double click in ie browser.
« on: December 01, 2014, 06:13:52 pm »
Hi ,

I am facing a weird issue. I am using filterhandler() and filterRender() functions.
I am using one textbox for entering the text for filtering. All the functionalities are working fine in google chrome but while checking in IE the filter textbox is losing focus while clicking on the textbox twice.

Below are the code
function filterhandler(evt, ui) {
         var $toolbar = $grid.find('.pq-toolbar-search'),
        $value = $toolbar.find(".filterValue"),
        value = $value.val(),
        condition = "begin",
        filterObject;
     filterObject = [{ dataIndx: 'vslName', condition: condition, value: value}];
    $("#grid_json").pqGrid("filter", {
        oper: 'replace',
        data: filterObject
    });
 }


function filterRender(ui) {
   
    var val = ui.cellData,
        filter = ui.column.filter;
    if (filter && filter.on && filter.value) {
        var condition = filter.condition,
            valUpper = val.toUpperCase(),
            txt = filter.value,
            txt = (txt == null) ? "" : txt.toString(),
            txtUpper = txt.toUpperCase(),
            indx = -1;
          if (condition == "begin") {
            indx = valUpper.indexOf(txtUpper);
              if (indx > 0) {
                indx = -1;
            }
        }
        if (indx >= 0) {
            var txt1 = val.substring(0, indx);
            var txt2 = val.substring(indx, indx + txt.length);
            var txt3 = val.substring(indx + txt.length);
            return txt1 + "<span style='background:yellow;color:#333;'>" + txt2 + "</span>" + txt3;
            $("#grid_json").pqGrid("refreshDataAndView");
            $('#grid').jqxGrid('ensurerowvisible', 2    );
           
        }else {
            return val;
        }
    }
    else {
        return val;
    }
}

and object is:

 var obj = {
               
               height:320,
               width:367,
               numberCell:false,
                  editable: false,
                  resizable:true,
               sortable:false,
                columnBorders: false,
                  scrollModel:{autoFit:false, theme:false},
                  draggable:false,
                  collapsible: { on: false, collapsed: false },
               showTitle: false,
               showBottom:false,
               dataModel: dataModel,
                colModel: colModel,
                numberCell: { show: false },
                stripeRows : false,
                
                 track: true,
                selectionModel: { type: 'none', subtype:'incr', cbHeader:true, cbAll:false}, 
               
                filterModel: {type:'local', mode: 'OR' },
                 toolbar: {
                     cls: 'pq-toolbar-search',
                     items: [
                             { type: "<span style='margin:3px; readonly='true''>Vessels</span>" },
                             { type: 'textbox',  cls: "filterValue", listeners: [{ 'keyup': filterhandler}] },
                             {type:'<button type="button" id="refresh" class="refresh refresh-primary">Clear</button>&nbsp;&nbsp;'},
                             {type:'<button type="button" id="ok" class="ok ok-primary" style="width:30px;">Ok</button>'},
                            /* {type:'<button type="button" id="cancel" class="cancel cancel-primary" style="width:50px;margin-left:5px;">Cancel</button>'},*/
                             ],
                     }, 
                                   
                        editable: true,
                        scrollModel: { horizontal: false },
                        showTitle: false,
                        columnBorders: false
                    };



Please help me with this issue.

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter textbox losing focus on double click in ie browser.
« Reply #1 on: December 01, 2014, 07:02:10 pm »
Could you please provide a functioning jsfiddle for the issue.
« Last Edit: December 01, 2014, 07:04:15 pm by paramquery »

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
Re: Filter textbox losing focus on double click in ie browser.
« Reply #2 on: December 03, 2014, 11:43:32 am »
Hi,

Its difficult for me to create jsfiddle for this as lot of functionality i am doing from my database side.

To elaborate the issue I can give some snapshots

In Capture.png file you can see the focus is there on the vessel textbox.
But when I click the textbox second time its losing the focus and due to that filtering is not working.