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 - angelahlp

Pages: [1] 2 3 4
1
I have a function that is not a part of the grid that is called independent of the grid which highlights a cell in the grid. I don't want to allow that independent function to run unless the grid is loaded.

Is my only option to have a global variable that stores a flag that gets set in the "complete" event?

2
I have functions that I don't want to fire until the grid has loaded. Is there a function that will return whether or not the grid has finished loading? That can be called on the grid object, not done during initialization?

Example:
if editorobj.isLoaded() then do action

I'm looking for the isLoaded() functionality.

TIA

3
Help for ParamQuery Pro / How do I add a class to a column?
« on: January 22, 2021, 12:42:42 pm »
I have the dataIndx for a column and want to add a class to it? It doesn't seem to be possible with the "addClass" method. Can you please tell me how to do this?

4
Hello,

I was wondering if you had any information yet on how to fix this issue?

Thanks

5
Here is example code for what I'm doing if it helps.
   var griditemobj = {
      title: "<B>Event Editor</B>",
      height: 'calc(100% - 55px)',
      allowInvalid: true,
      rowBorders: true,
      columnBorders: true,
      stripeRows : false,
        resizable: true,
      collapsible: { on: false, toggle: false , css: { margin: "50px 0 55px 200px" }},//toggled: true,
      editor: { select: true },
      numberCell: { show: true },
      scrollModel: { autofit: true },
      swipeModel: { on: true },
      trackModel: { on: true }, //to turn on the track changes.
        filterModel: { header: true, type: 'local', menuIcon: true },
      sortModel: { single: false, multiKey: 'shiftKey' },
      cellKeyDown: function( event, ui ) {
         var nextrow = ui.rowIndx;
         var nextcol = ui.colIndx;
         
         // deal with add row with tab at last cell
         var totalRecords = this.option('dataModel.data').length - 1;
         var totalcolumns = this.getColModel().length - 1;
            
         if (event.keyCode == 9 && ui.rowIndx == totalRecords && ui.colIndx == totalcolumns ) {
            var dt = new Date();
            var usetime = dt.getHours() + ":" + dt.getMinutes().toString().padStart(2, '0') ;
            var rowData = { griditemnumber: 0, commandid: "6", command: "First", movestatusid: 1, status: "New", startdate: jsstartdate, starttime: usetime, iskey: false}; //new row initial contents

            var newrow = addRowLocal(rowData);            
         }
      },
      
      toolbar: {
         items: [
            { type: 'button', icon: 'ui-icon-plus', label: 'New', listener:
               { "click": function (evt, ui) {
                  var dt = new Date();
                  var usetime = dt.getHours() + ":" + dt.getMinutes().toString().padStart(2, '0') ;
                  var rowData = { filename: '&', griditemnumber: GLOBAL.nextnum, commandid: "6", command: "Contextual", statusid: 1, status: "Pending", startdate: jsstartdate, starttime: usetime, modeid: 1, modewhat: "New", iskey: false }; //new row initial contents
                  var returnval = addRowLocal(rowData);
                  }
               }
            },
             { type: 'separator' },
            { type: 'button', icon: 'ui-icon-disk', label: 'Save', cls: 'changes', listener:
               { "click": function (evt, ui) {
                  savegriditemChanges();
               }
               },
               options: { disabled: true }
            },
                { type: 'separator' },
                {
                    type: 'button', icon: 'ui-icon-arrowreturn-1-s', label: 'Undo', cls: 'changes', listener: function () {
                        this.history({ method: 'undo' });
                    },
                    options: { disabled: true }
                },
                {
                    type: 'button', icon: 'ui-icon-arrowrefresh-1-s', label: 'Redo', listener: function () {
                        this.history({ method: 'redo' });
                    },
                    options: { disabled: true }
                }
         ]
      },
      history: function (evt, ui) {
         var $tb = this.toolbar();
         if (ui.canUndo != null) {
            $("button.changes", $tb).button("option", { disabled: !ui.canUndo });
         }
         if (ui.canRedo != null) {
            $("button:contains('Redo')", $tb).button("option", "disabled", !ui.canRedo);
         }
         $("button:contains('Undo')", $tb).button("option", { label: 'Undo (' + ui.num_undo + ')' });
         $("button:contains('Redo')", $tb).button("option", { label: 'Redo (' + ui.num_redo + ')' });
      },

      colModel: [
         { title: "ID", dataType: "integer", dataIndx: "moveid", editable: true, hidden: true},
         
         { title: "#", minWidth: 50, maxWidth: 60, dataType: "string", align: "center", dataIndx: "griditemnumber", editable: true, hidden: false,
            render: function (ui) {
               var cellData = ui.cellData;
               if (!cellData) {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
                filter: { menuIcon: false },
         },
         { title: "Key", type: "checkbox", minWidth: 40, maxWidth: 40, dataType: "bool", align: "center", dataIndx: 'iskey', editor: true,
                cb: {all: false, header: false},
                filter: { crules: [{ condition: "equal" }] }
         },
         { title: "Date", minWidth: 75, maxWidth: 90, align: "center", editable: true, dataIndx: "startdate", dataType: 'date',
            editor: {
               type: 'textbox',
               init: dateEditor
            },
            render: function (ui) {
               var cellData = ui.cellData;
               if (cellData) {
                  return $.datepicker.formatDate('m/d/y', new Date(cellData));
               } else {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
            validations: [
               { type: 'regexp', value: '^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2})$', msg: 'Not in m/d/yy format'  },//, warn: true
            ],
                filter: { menuIcon: false }
         },
         { title: "Time", minWidth: 60, maxWidth: 75, align: "center", dataType: "string", dataIndx: "starttime",
            render: function (ui) {
               var cellData = ui.cellData;
               if (!cellData) {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
            validations: [
               { type: 'regexp', value: '^(([0-9])|([0-1][0-9])|([2][0-3])):?([0-5][0-9])$', msg: 'Not in HH:MM format' }
            ],
                filter: { menuIcon: false }
         },
         { dataIndx: "commandid", hidden: true },
         { title: "Type", minWidth: 90, maxWidth: 100, dataIndx: "command",
            editor: {
               type: 'select',
               options: arrCommands,
               valueIndx: "commandid",
               labelIndx: "command"
            },
            render: function (ui) {
               var cellData = ui.cellData;
               if (!cellData) {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
                filter: { crules: [{ condition: 'contain'}], listeners: ['keyup'] }
         },
         { dataIndx: 'fromuserid', hidden: true }, //hidden column to store Id.
         { title: "From", minWidth: 150, dataIndx: "fromusername",
            editor: {
               type: 'select',
               options: arrfromusers,
               valueIndx: "fromuserid",
               labelIndx: "fromusername"
            },
            render: function (ui) {
               var cellData = ui.cellData;
               if (!cellData) {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
                filter: { crules: [{ condition: 'contain'}], listeners: ['keyup'] }
         },

         { dataIndx: "touserid", hidden: true },
         { title: "To", minWidth: 150, dataIndx: "tousername",
            editor: {
               type: 'select',
               options: arrtousers,
               valueIndx: "touserid",
               labelIndx: "tousername"
            },
            render: function (ui) {
               var cellData = ui.cellData;
               if (!cellData) {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
                filter: { crules: [{ condition: 'contain'}], listeners: ['keyup'] }
         },
         { title: "Subject", minWidth: 200, dataType: "string", dataIndx: "namefield",
            editor: {
               type: 'textarea', attr:'rows=3'
            },
            render: function (ui) {
               var cellData = ui.cellData;
               if (!cellData) {
                        return {cls: 'pq-cell-blue-tr'};
               }
            },
                filter: { crules: [{ condition: 'contain'}], listeners: ['keyup'] }
         },

         { dataIndx: "modeid", hidden: true },
         { title: "Mode", minWidth: 80, maxWidth: 90, dataIndx: "modewhat",
            editor: {
               type: 'select',
               options: arrmode,
               valueIndx: "modeid",
               labelIndx: "mode"
            },
                filter: { crules: [{ condition: 'contain'}], listeners: ['keyup'] }
         },
         
         { title: "", editable: false, minWidth: 40, maxWidth: 40, width: 40, align: "center", sortable: false, title: "Del", dataIndx: "Del",
            render: function (ui) {
               return "<button type='button' class='ui-button ui-corner-all ui-state-default ui-button-icon-only delete_btn'><span class='ui-icon ui-icon-trash'></span></button>";
            },
            postRender: function (ui) {
               var grid = this,
                  $cell = grid.getCell(ui);

               $cell.find(".delete_btn")
                  .bind("click", function (evt) {
                     $griditemgrid.addClass({ rowIndx: ui.rowIndx, cls: 'pq-row-delete' });

                     var ans = window.confirm("Are you sure to delete griditem Number " + ui.rowData.griditemnumber + "?");
                     if (ans) {
                        $griditemgrid.deleteRow({ rowIndx: ui.rowIndx });
                     }
                     else {
                        $griditemgrid.removeClass({ rowIndx: ui.rowIndx, cls: 'pq-row-delete' });
                     }
                  });
            },
                filter: { menuIcon: false }
         }
         
      ],
      postRenderInterval: -1, //call postRender synchronously.
      dataModel: {
         dataType: "JSON",
         sorting: "local",
         sortIndx: "startdate",
         sortDir: "up",
         location: "remote",
         recIndx: "moveid",
         url: "/url/&returnFormat=json",
         getData: function (response) {
            return { data: response };
         }
      }
   };
   var $griditemgrid = pq.grid("#griditem_editing", griditemobj);
   

6
Hi,

I recently switched from version 3.5 to 7.5. When I use the 3.5 code when I tab to the end of a row the next tab takes me to the first column of the next row. Now that I've switched to 7.5 this is no longer happening?

Can you tell me what I need to do to make this work in version 7.5?

7
I need to dynamically disable a row or cell based on the recId. The recId is being sent from an outside source and the related row/cell needs to be disabled/enabled accordingly.

Can you tell me how to accomplish that. I saw the "editable" "option" and demo, but can't seem to get it to work.

8
Help for ParamQuery Pro / Re: updaterow not showing in grid
« on: December 18, 2020, 12:24:14 am »
I need to update the rows from other sources, not just grids. Can you tell me how I need to format the rowData so that it can be used to update a row?

9
Help for ParamQuery Pro / Re: updaterow not showing in grid
« on: December 17, 2020, 02:47:04 am »
I'm having trouble getting the grid to display in jsfiddle. For some reason the heights are getting set to 0px or 1px ? Could you send me a starter jsfiddle that has the correct includes? (I can update links to the paramquery files if necessary. Ultimately I'd like to know how I'm supposed to set this up in JSFiddle so that it works.

Essentially I have two grids. Each one is sending grid updates to the other, both receiving these updates as a rowData object. I then need to update the grid based on the rowData sent:

1. Grid One receives an object that contains updated rowData from Grid Two.
    The rowData sent from Grid Two comes from the "change" event which sends ui.updateList[0].rowData to Grid One.
    NOTE: Ultimately, I need to send rowData updates from other sources besides pqgrids. So the rowData that is sent needs to be in a standard format that can be duplicated by other systems.

2. Grid One finds the rowIndx in it's grid for the rowData sent by Grid Two

3.Using that rowIndx and the rowData sent by Grid Two, Grid One updates that row with the rowData that was sent by Grid Two.
that and then updating it

Code that runs when updated rowData is received (sent into function by "change" through newrowdata variable) as described above:
var userowindx = editorgrid.getRowIndx( {rowData: newrowdata} ); 
editorgrid.updateRow( { rowData: newrowdata, rowIndx: userowindx.rowIndx  });

I've attached the structure of what is being sent as the "newrowdata" (as shown in the console).

10
Help for ParamQuery Pro / Re: updaterow not showing in grid
« on: December 16, 2020, 12:11:07 pm »
When I change the parameter "rowData" to "newRow" I get an error message - different on all browsers (included below). I tried adding "checkEditable" and it also does not work. It DOES still find the rowindx based on the rowdata input....

Firefox:
Uncaught TypeError: e is undefined
    saveCell (URL)/js/paramquery-7.5.0/pqgrid.min.js:10
    _digestUpdate (URL)/js/paramquery-7.5.0/pqgrid.min.js:11
    _digestData (URL)/js/paramquery-7.5.0/pqgrid.min.js:11
    updateRow (URL)/js/paramquery-7.5.0/pqgrid.min.js:14

Microsoft Edge:
pqgrid.min.js:14 Uncaught TypeError: Cannot read property 'dataType' of undefined
    at e.cUCData.update (pqgrid.min.js:14)
    at t.<computed>.<computed>.a._digestUpdate (pqgrid.min.js:11)
    at t.<computed>.<computed>.a._digestData (pqgrid.min.js:11)
    at t.<computed>.<computed>.n.updateRow (pqgrid.min.js:14)

11
Help for ParamQuery Pro / updaterow not showing in grid
« on: December 16, 2020, 11:33:04 am »
I am using version 7.5. I am trying to update the rowdata for a row in the grid. This is the code that I'm using but the grid does not change. I tried to use refreshrow, although it does not seem necessary, but it still does not work.

I need to update the row only knowing what the rowdata is. I don't have the rowindex. But I have confirmed that the rowindx is found when I get it from the rowdata provided. The rowdata comes straight from another identical grid.

var userowindx = editorgrid.getRowIndx( {rowData: rowdata} );
editorgrid.updateRow( { rowData: rowdata, rowIndx: userowindx.rowIndx  });

Please tell me why the grid is not updating.

12
I am using the selectEnd event and am only provided with the rowindx and the colindx. How can I get the dataIndx from the colIndx or from selectEnd?

Thank You

13
could you give an example for the solution for this?

14
The dateeditor that I'm using is straight from the "Editors and Validations" demo. I tried putting the dateFormat option in the editor, but maybe I'm not doing it right as it still didn't work.

        var dateEditor = function (ui) {
            var $inp = ui.$cell.find("input"),
                $grid = $(this),
                validate = function (that) {
                    var valid = $grid.pqGrid("isValid", {
                        dataIndx: ui.dataIndx,
                        value: $inp.val(),
                        rowIndx: ui.rowIndx
                    }).valid;
                    if (!valid) {
                        that.firstOpen = false;
                    }
                };

            //initialize the editor
            $inp
            .on("input", function (evt) {
                validate(this);
            })
            .datepicker({
                changeMonth: true,
                changeYear: true,
                showAnim: '',
                onSelect: function () {
                    this.firstOpen = true;
                    validate(this);
                },
                beforeShow: function (input, inst) {
                    return !this.firstOpen;
                },
                onClose: function () {
                    this.focus();
                }
            });
        }

15
Help for ParamQuery Pro / default date with datepicker when adding row
« on: October 01, 2015, 01:26:42 am »
I'm trying to set a default value for a datepicker field so that when a new row is created it autofills with the default. I've tried a couple of things, but the date field with the datepicker is always blank when a new record is created.

This is the addrow button:

                    { type: 'button', icon: 'ui-icon-plus', label: 'Add Inject', listener:
                        { "click": function (evt, ui) {                   
             var rowData = { griddate: "3/10/15" };
                            $grid.pqGrid("addRow", { rowData: rowData, rowIndxPage: 0 });
                            $grid.pqGrid("setSelection", { rowIndxPage: 0 });
                            $grid.pqGrid("editFirstCellInRow", { rowIndxPage: 0 });
                        }
                        }
                    },

This is the colmodel definition:
             { title: "Date", minWidth: 30, width: 75, dataIndx: "griddate", dataType: 'date',
                 editor: {
                     type: 'textbox',
                     init: dateEditor
                 },
                 render: function (ui) {
                     //return "hello";
                     var cellData = ui.cellData;
                     if (cellData) {
                         return $.datepicker.formatDate('m-d-y', new Date(cellData));
                     }
                     else {
                         return "";
                     }
                 },
                 validations: [
                       { type: 'regexp', value: '^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2})$', msg: 'Not in m/d/yy format' },
                   ]   
            },

Pages: [1] 2 3 4