Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - waldemarb

Pages: [1]
1
Hi,

Please help.
I am trying to place a checkbox, that sellects all rows in view, in the header and I can not succeed.
My code below.

Thank you,
Waldemar



function claims_drawGrid() {
   //console.log('inside claims_drawGrid.');
   //debugger;
   
    function pqDatePicker(ui) {
         var $this = $(this);
         $this
             .css({ zIndex: 3, position: "relative" })
             .datepicker({
                 yearRange: "-10:+0", //10 years prior to present.
                 changeYear: true,
                 changeMonth: true,
                 //showButtonPanel: true,
                 onClose: function (evt, ui) {
                     $(this).focus();
                 }
             });
         //default From date
         $this.filter(".pq-from").datepicker("option", "defaultDate", new Date("2014/01/01"));
         $this.filter(".pq-from").datepicker( "option", "dateFormat", "yy/mm/dd" );
         
         //default To date
         $this.filter(".pq-to").datepicker("option", "defaultDate", new Date("2016/12/31"));
         $this.filter(".pq-to").datepicker( "option", "dateFormat", "yy/mm/dd" );
     }

   var gridD = null;
   var obj = {
      width : "100%",
      height : 800,
      editable : false,
      editModel: { clicksToEdit: 2, saveKey: 13},
      resizable : true,
      track: true,
      collapsible: false,
      rowBorders: false,
        columnBorders: false,
      showTitle : false,
      selectionModel: {type: 'none', subtype: 'incr', cbHeader: false, cbAll: true},
      //selectionModel: { type: 'row' , mode: 'range', all: null, cbAll: null, cbHeader: true },
      //selectionModel: {type: 'row', subtype: 'incr', cbAll: true,  cbHeader: true},
        filterModel: { on: true, mode: "AND", header: true },
        rowSelect: function (evt, ui) { claims_setSelectedRow(ui) },
        rowUnSelect: function (evt, ui) { claims_reSetSelectedRow(ui) },
        numberCell: {show: false},
        //minWidth: 30,
        pageModel: {type: "local", rPP: 15, rPPOptions: [5, 10, 15, 25, 50, 100]},
      colModel: [
          //{title : "<label><input type='checkbox' /></label>", dataIndx : "cbStatus",
         {title : "", dataIndx : "cbStatus", width : 10, align : "center", type : 'checkBoxSelection',
         cls : 'ui-state-default', resizable : false, sortable : false, hidden : false },
         {dataIndx: 'clmStatusDesc', title: 'Status', width: '80',
               filter: {type: 'textbox', condition: 'begin', listeners: ['keyup']},
            render: function (ui) {
               var flData = ui.rowData.clmStatusDesc;               
               if (flData == undefined || flData.trim() == "") {flData = 'New'};
               return flData;
            }
         },
           {dataIndx: 'reviewer', title: 'Reviewer', width: '150', editable: true,
               filter: {type: 'textbox', condition: 'contain', listeners: ['keyup']},
               render: function (ui) {
               var flData = ui.rowData.reviewer;
               if (flData == undefined || flData.trim() == "") {flData = 'Unassigned'};
               return flData;
            }
           },
           {dataIndx: 'iot', title: 'Region', width: '100',
               filter: {type: 'textbox', condition: 'begin', listeners: ['keyup']}},
           {dataIndx: 'ctryDesc', title: 'Country', width: '100',
               filter: {type: 'textbox', condition: 'begin', listeners: ['keyup']}},
           {dataIndx: 'clmNumber', title: 'Claim Number', width: '110',
               filter: {type: 'textbox', condition: 'contain', listeners: ['keyup']},
               render: function (ui) {
                   var flData = ui.rowData.clmNumber;
                   var sLink = '<a class="underline highlight" href="ClaimItem.html?clmNbr='
                      + flData + '" target="_self">' + flData + '</a>';
                   return sLink;
                  }
           },
           {dataIndx: 'clmName', title: 'Claim Description', width: '220',
               filter: {type: 'textbox', condition: 'contain', listeners: ['keyup']}},               
            {dataIndx: 'clmAmount', title: '$ Amount', width: '95',
              filter: {type: 'textbox', condition: 'gte', listeners: ['keyup']}
               ,render: function(ui){
                  return appFormatCurrency(ui.cellData);
               }
            },
           {dataIndx: 'ovrallScr', title: 'Risk Score', width: '70',
               filter: {type: 'textbox', condition: 'gte', listeners: ['keyup']}},
            {dataIndx: 'shrtScrCmmnts', title: 'Reason', width: '160',
                  filter: {type: 'textbox', condition: 'contain', listeners: ['keyup']}},
           {dataIndx: 'empName', title: 'Requester', width: '160',
               filter: {type: 'textbox', condition: 'contain', listeners: ['keyup']}},                     
           {dataIndx: 'paiddate', title: 'Paid date', minWidth: '130', dataType: "date",
               filter: {type: 'textbox', condition: "between", init: pqDatePicker, listeners: ['change']},
               render: function (ui) {
                  var flData = new Date(ui.rowData.paiddate);
                  flData = jQuery.datepicker.formatDate('yy/mm/dd', flData);
                  return flData;
               }
           },
           //{ title: "", dataIndx: "state", width: 30, align: "center", type:'checkBoxSelection', cls: 'ui-state-default', resizable: false, sortable:false }
            //{ title: ' ', width: '0', dataType: "text"}
      ],
       dataModel: { location: "local", sorting: "local", recIndx: "clmNumber" }
   };

   appGrid = $("#gridAllClaims").pqGrid(obj);
};


2
Hi,

I have an issue with adding a 'sellect all' checkbox to the header.
No matter what I do is not working.
I have to mention that I am using header filters.

Now I found this tread:
http://paramquery.com/forum/index.php?topic=779.0
stating that:
'cbHeader is incompatible with filtering currently. It would be updated in next version.'

Is this corrected now in Free version or will be done later ?

Thank you,
Waldemar

3
Code: [Select]
  rowData.reviewer = sReviewerName;           

Since rowData is a reference to the row object, it updates the rowData before leaving a chance for updateRow to make a diff of the changes.


Instead try this:

Code: [Select]
  myGrid1.pqGrid( "updateRow", {rowIndx: mySelection.rowIndx, row: { reviewer: sReviewerName }} );

Thank you very much. This worked for me.
Here is final version of this function, in case someone needs it:


        var sReviewerName;
        function setSelectedRecords() {   
           //debugger;         
            sReviewerName = $('#rList').data('selected').text;                             
            mySelection = myGrid1.pqGrid( "selection", { type:'row', method:'getSelection' });
           
            for (var i = 0; i < mySelection.length; i++)
            {            
            myGrid1.pqGrid( "updateRow", {rowIndx: mySelection[ i ].rowIndx, row: { reviewer: sReviewerName }} );
            myGrid1.pqGrid( "refreshCell", { rowIndx: mySelection[ i ].rowIndx, dataIndx: 'reviewer' } );                  
            }
            myGrid1.pqGrid( "setSelection", null );
        };




4
Just forgot to add a code snipet that sets the values in selected rows:

   var sReviewerName;
        function setSelectedRecords() {   
           debugger;         
            sReviewerName = $('#rList').data('selected').text;
            sReviewerName = sReviewerName + '\u000D\u000A';
            //alert('sReviewerName' + '\u000D' + '\u25B4' );                               
            mySelection = myGrid1.pqGrid( "selection", { type:'row', method:'getSelection' });
           
            var rowData = null;           
           
            for (var i = 0; i < mySelection.length; i++)
            {                           
            rowData = myGrid1.pqGrid( "getRowData", {rowIndx: mySelection.rowIndx} );
            rowData.reviewer = sReviewerName;           
            myGrid1.pqGrid( "updateRow", {rowIndx: mySelection.rowIndx, row: rowData, track: true} );
            myGrid1.pqGrid( "refreshCell", { rowIndx: mySelection.rowIndx, dataIndx: 'reviewer' } );               
            }
            myGrid1.pqGrid( "setSelection", null );
        };

5
Hi,

I have a pqgrid that I would like to update in the following way:
1. I manually select few rows, by selecting check-boxes.
2. Above grid there is 1 drop-down and 2 buttons. 1st called 'Apply reviewer', 2nd called 'Save changes'.
3. I pick a value from a drop-down, and push the 1st button 'Apply reviewer'
4. Selected rows got new value.

The problem is, that the pqgrid does not acknowledges any change.
Red triangles are not visible and
  var isDirty = gridD.isDirty(); returns 'false' and
  var changes = gridD.getChanges({ format: "byVal" }); returns 0,0,0 objects and
  var changes2 = gridD.getChanges(); returns 0,0,0 objects.

But when I type something into cell, triangles are there.

Please help.
If you need more info please let me know.

Thank you very much.



Pages: [1]