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

Pages: 1 [2] 3 4 ... 6
16
Help for ParamQuery Pro / Re: Switch to local pageModel for Excel Export
« on: December 13, 2016, 02:07:24 am »
So the only event I found for triggering when the new data is loaded is the load event "load( event, ui )".  I pulled the export code out of the toolbar listener and put it into the load event instead.  The toolbar export button now sets a global 'exporting' flag and changes the page mode.  All as below.  It works fine, but I wondered if I've overlooked a better way for example adding the load event listener into the toolbar function as a callback?  Thanks for your advice or suggestions if you have time.

Code: [Select]
{
type: 'button',
label: "Export",
icon: 'ui-icon-arrowthickstop-1-s',
listener: function () {
pageModel.type = 'local';
this.option( "pageModel", pageModel);
bExporting = true;
this.refreshDataAndView();
}

Code: [Select]
myGrid.on("load", function (evt, ui) {
if (bExporting) {
var format = $("#export_format").val(),                           
blob = this.exportData({
//url: "/pro/demos/exportData",
format: format,                               
render: true
});
if(typeof blob === "string"){                           
blob = new Blob([blob]);
}
saveAs(blob, "PartMaster."+ format );
bExporting = false;
pageModel.type = pageModelType;
this.option( "pageModel", pageModel);
this.refreshDataAndView();
}
});

17
Help for ParamQuery Pro / Switch to local pageModel for Excel Export
« on: December 09, 2016, 08:47:35 pm »
Normally I use 'remote' type for pageModel so I reduce the amount of data traffic to load into each page.  But when the customer wants to export to Excel only the current page view is exported (e.g. 50 rows).  To work around this I have page options dropdown selector for up to 1000 rows, but it is still not very convenient.

I am trying to switch temporarily to pageModel type: 'local' just before the Excel export, refresh the grid to load all rows from the remote database, and then switch back to pageModel type: 'remote' for normal operation again.

I have tried...

Code: [Select]

        myGrid.on("beforeExport", function (evt, ui) {
pageModel.type = 'local';
this.option( "pageModel", pageModel);
this.refreshDataAndView();
});

myGrid.on("exportData", function (evt, ui) {
pageModel.type = pageModelType;    //pageModelType is just a variable set to 'remote'
this.option( "pageModel", pageModel);
this.refreshDataAndView();
});

...but the exported data is still just 50 rows instead of 50000.  Do I need to apply code for a listener for the grid data to be refreshed following the "beforeExport" event?

Can you guide me please?

18
You possibly already spotted this related bug...

The export to Excel also displays the wrong column widths having included all defined column widths even those with Copy: False.  This is very noticeable when exporting a grid that uses the first column as a dropdown/details control.  This column is traditionally very narrow (only displaying triangle icon), but this column width is used for the first exported data column.

19
Help for ParamQuery Pro / Re: Icon-only Button in Toolbar
« on: December 01, 2016, 05:26:03 pm »
That's brilliant.  You are a genius.  I'd love to know how you figured that out so fast.

Works very well for 'Save changes', 'Undo', 'Redo', 'Cancel Changes' and 'Refresh'...all very well know icons these days.  My toolbar looks a lot simpler now.  Thank you.

Quick note: I did provide a replacement css to increase the width slightly and remove the padding that was making the first try a little tall...

   .pq-grid button.ui-button-icon-only {
      width: 32px;
      margin-right: 5px;
      padding: 0 0;
   }

20
Help for ParamQuery Pro / Icon-only Button in Toolbar
« on: November 30, 2016, 12:57:26 am »
I'm trying to save space on the toolbar by using buttons with an icon only, i.e. without the text label.  By default this results in a very thin button, only 8 pixels tall because of the 4 pixel dimension of the curved corners.

I've tried changing various properties (e.g. height) using 'style', and I've tried implementing a new 'cls', but I'm not having any luck.  Finally I tried using 'ui-button-icon-only' from Jquery UI but I couldn't get that to change anything either.

Can you help?  Many thanks.

21
For anyone who does what I did and copy and paste the reply code sample above, please be aware of the small typo pqgrid should read pqGrid (note upper case G).

var child = rowData.pq_detail.child.pqGrid( 'instance' );


22
A workaround has just dawned on me and it seems to work...

Simply move the columns with copy:false and hidden:true to the bottom of the colmodel list and the export to Excel can't pick up the hidden definition by mistake.  All exported columns are immediately visible in Excel.

Thanks.

Tony

23
I'm finally getting round to updating to version 3.3 and using the improved Excel export features, but I may have spotted a bug.

With this grid column model...

   var colDetail = [
      { title: "pick_part_id", minWidth: 75, maxWidth: 100, dataType: "integer", dataIndx: "pick_parts_id", resizable: false, copy: false, editable: false, hidden: true },
      { title: "picklist_id", minWidth: 75, maxWidth: 100, dataType: "integer", dataIndx: "picklist_id", resizable: false, copy: false, editable: true, hidden: true },
      { title: "Part Number", cls: 'bold_column', minWidth: 250, dataIndx: "partnumber", editable: true },
      { title: "Part Name", cls: 'bold_column', minWidth: 300, dataIndx: "partname", editable: false },
      { title: "Qty Per", minWidth: 100, dataType: "integer", dataIndx: "pickqtyper", align:"center", editable: true },
      { title: "Last Modified", minWidth: 175, dataIndx: "pick_parts_modified", align:"center", editable: false, dataType:"date" }
   ];

... I get four columns exported, which is fine because the first two column definitions have "copy: false".  However Excel hides its first two of the four (partnumber and partname) because it's taking the "hidden: true" definition from my non-copied columns (pick_part_id and picklist_id).  I've tested this two ways so far, first by setting 'hidden:false' on the picklist_id and then Excel only hides partnumber; and second I modified your "Local Export" demo http://paramquery.com/pro/demos/export_local adding

            { title: "Hidden Data", width: 130, dataIndx: "HiddenData", copy: false, hidden: true },
 
at the top of your definition.  With this changed, and then export to Excel, Excel hides the ContactName column.

Assuming I'm not simply doing something wrong...can you offer a workaround for this?

Many thanks.

Tony

24
Help for ParamQuery Pro / Grid Toolbar Button to Select/Load Local File
« on: September 07, 2016, 05:30:03 pm »
I'd like to use a button on the grid toolbar to load a local file into the grid.  Most of the jQuery examples I've found still use an html <input type="file"> and respond to or trigger its click event.  Do you know instead if I can use one of your buttons placed on the grid toolbar?

Alternatively, have you done this before and have a solution you can share?

Much appreciate any support/ideas you can offer.  Thanks.

25
I've just tested the same thing with your v3.3 demo and it works ok...no editing problem.

You will see the problem in v3.2 though.  I am still using v3.2.  Are you able to explain the difference, or the fix that happened with v3.3?

I can see that I shouldn't put off the upgrade to v3.3 any longer.

26
Thanks. I haven't mastered things in jsfiddle yet, sorry.

I have managed to recreate the problem using your examples, perhaps you could check it out for me...or spot what I'm doing wrong.

I've changed two lines in your "Grid Parts" demo so that the obj variable is now as follows...

        var obj = {       
            width:'100%',     
            height: 360,
            showTop: false,
            showBottom: false,
            //collapsible: false,
            showHeader: false,
            roundCorners: false,
            rowBorders: false,
            columnBorders: false,                                   
            selectionModel: { type: 'cell' },
      hoverMode: 'row',
//            numberCell: { show: false },
      numberCell: { show: true, resizable: true, title: "" },
            stripeRows: false,
            title: "Grid Constituents",
            toolbar: {
                items: [
                { type: "button", label: 'button on toolbar' }
            ]
            }
        };

The changes are to include hovermode as row, and enable the number cell.  Then I clicked "Edit and Run" and it showed the same behaviour as I get (remember only with IE11 not with Chrome).
Then double click a cell to edit the cell text contents, but before typing move the mouse outside the text box and you may find the cursor and text vanish and a tiny text box and cursor appear in the very top left position of the grid.

Let me know if this recreates with you as well and I look forward to your advice on which element I've got wrong or missed when setting the grid up in this way.

Many thanks.

Tony

27
Help for ParamQuery Pro / Combining Remote and Local Filter
« on: July 27, 2016, 08:35:24 pm »
I currently use remote data, remote sort and remote filter.  All works fine.

I now have a new column that I need to filter locally once the remote data is displayed on grid.  The reason this column needs a local filter is that it would otherwise change the whole dataset and upset some calculations if the data is actively removed...I just want to able to filter the grid results without affecting the rest of the row.

I read one of your other forum responses which suggested switching to local filter temporarily and then reverting back to remote after the local filter had been applied.  Is this the best/only approach or can I set an individual column to be a local filter only?  Either way I'm not really sure how to do it.

Hope you can help.

Regards, Tony.

28
Bug Report / Strange Behaviour in Edit Cell with Internet Explorer
« on: July 25, 2016, 02:47:25 pm »
I use inline editing like your "Batch Editing" example.  It works fine but I have an odd behaviour in IE11 that I hope you can help with.

When I double click on the cell it activates the text box for editing, but in Internet Explorer if I move the mouse away from the cell the cursor jumps out of the cell and appears in the extreme top left of the grid.  I don't see this behaviour in Chrome which works perfectly.

I guess this must be a css parameter that I've got wrong somewhere...perhaps something to do with 'hover' but I don't really know where to look.  What should I be looking for to change css parameters related to edittext boxes and probably pqselect.

Any pointers would be greatly appreciated.

Many thanks.

29
Help for ParamQuery Pro / Re: Angle Brackets being removed
« on: July 12, 2016, 06:09:33 pm »
Ok, so after I worked out it was an HTML browser issue and not a javascript grid issue I solved it with render.  Does this look like the right way to solve it...

         render: function(ui) {
            var strPartName = ui.cellData;
            strPartName = strPartName.replace(/</g, "&lt;");
            strPartName = strPartName.replace(/>/g, "&gt;");
            return strPartName;
         }

Thanks and regards

Tony

30
Help for ParamQuery Pro / Angle Brackets being removed
« on: July 12, 2016, 02:58:20 pm »
I'm testing for special characters today to find out what needs to be escaped or url encoded, but I don't know how to handle what I found.

If I include angle brackets in a cell then the displayed content of the cell changes.

Example 1: If I put a tag-style word into a grid cell then it disappears from the display altogether.  Although the full word still exists and is sent/received by JSON to the database.  Try putting this text into a grid cell to see what I mean - "Enter this <text> like this".  If you put that small phrase into a grid cell you notice that the <text> word disappears from display altogether.

Example 2: If I put a lt sign (<) into a grid cell followed directly by more text then all the subsequent text vanishes.  Try putting this text into a grid cell to see what I mean - "Enter this <text into cell".  If you put that small phrase into a grid cell you notice that everything to the right of the < sign is removed leaving only "Enter this ".

You can try both of these examples in your own batch editing demos.

Can you explain to me what is actually happening with these examples and suggest where I can add an escape character or other encoding to make sure all text is displayed?

Many thanks for your help

Pages: 1 [2] 3 4 ... 6