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

Pages: [1]
1
We just noticed this code messes with the grid calendar. 
The calendar displays but you cannot choose a date. 
The error message is:
Uncaught Missing instance data for this datepicker

We modified your code as follows:
$( document ).on ( "blur", ".pq-editor-focus", function(evt){
  var $grid = $(this).closest(".pq-grid");
  //$grid.pqGrid("saveEditCell");
  $grid.pqGrid("quitEditMode");
});

Any thoughts?
Thanks,
Bill

2
Oops.  Forgot to upgrade the CSS.

Rookie mistake!

3
There are no error messages.  The grid has three fields: plain text, date (with popup calendar), and list (select w/options).  When you click in any cell to edit a field opens in the lower left corner.  The calendar and select list work correctly.  Changes are submitted correctly to the database.

var $donationGrid = $( "#donation-grid" ).pqGridM({ width: 300, height: 160,
  minWidth: 1,
  hwrap: false,
  dragColumns: {enabled:false},
  wrap: false,
  showTop: true,
  title: 'Donations',
  plusButton: true,
  showBottom: false,
  collapsible:false,
  rowBorders:true,
  columnBorders:false,
  numberCell: { show: false },
  editable: true,
  track: true,
  selectionModel: { type: 'row', mode: 'single' },
  hoverMode: 'cell',
  editModel: {saveKey: $.ui.keyCode.ENTER,
              keyUpDown: true,
              cellBorderWidth: 1,
              clicksToEdit: 1},
  colModel: [{title:"ID",     width:10,  dataType:"integer", dataIndx:"donation_id", hidden:true},
             {title:"Date",   width:100, dataType:"date",    align:"left", dataIndx:"date_", editor: { type: dateEditor }},
             {title:"Type",   width:100, dataType:"string",  align:"left", dataIndx:"type_", editor: { type: 'select', options: lstDonationType }},
             {title:"Amount", width:90,  dataType:"integer", align:"left", dataIndx:"amount"}],
  dataModel: {dataType: "JSON",
              location: "remote",
              method: "GET",
              recTbl: "donations",
              recIndx: "donation_id",
              fKey: "contact_id"},
  plusClick: function (evt, ui) { addGridRow(this, evt, ui); },
  quitEditMode: function (evt, ui) { $(this).pqGridM("saveEditCell"); mrkFrmChanged() },
  cellBeforeSave: function (evt, ui) { checkGridData(this, evt, ui); },
  rowRightClick: function(evt, ui) { deleteGridRow(this, evt, ui) }
})


4
Here's the screenshot with the editor at the bottom.

5
I encountered the same problem when I switched from 2.02 to 2.03

When I edit a field the column headers disappear and the editor shows at the bottom left.  Also, delete does not throw the isDirty flag.



6
Help for ParamQuery Pro / Changes not seen when user clicks outside grid
« on: November 05, 2013, 06:28:11 am »
Is there a way to fire the saveEditCell when the grid looses focus?  My users will edit a cell and then click elsewhere on the form.  The cellUnSelect event is ignored.

Thanks

7
Help for ParamQuery Pro / Re: autocomplete to link foreign key field
« on: November 01, 2013, 03:24:05 am »
Thanks

8
Help for ParamQuery Pro / Re: autocomplete to link foreign key field
« on: October 31, 2013, 09:39:00 am »
rowData["user_id"] = ui.item.id;
updates the cell but doesn't mark the cell as dirty.

Is there a way to mark the cell as dirty the same time I write to it?

The attachment shows the error message I get from: $(this).data("autocomplete").search($(this).val());

Thanks,
Bill

9
Help for ParamQuery Pro / autocomplete to link foreign key field
« on: October 30, 2013, 01:22:13 am »
My grid has a foreign key link to the user table.  I would like to use autocomplete to search the user table for users by name but store only the user_id in the database.

Everything is working except I don't know how to store the user Id field in the grid.

( ui.item.id ) is the correct user_id value

How do I write it to the dataIndx:"user_id"?

I would also like to hear suggestions of how to not write the user_descriptor field to the database on save.

Bonus points:
.focus(function () {
        $(this).data("autocomplete").search($(this).val());
}
throws an error message, but everything works when its commented out.  Any ideas what it does and if I need it?

Parts:

dataModel:
  {title:"User ID",  width:4, dataType:"integer", dataIndx:"user_id", hidden:true},
  {title:"User", width:100, dataType:"string", dataIndx:"user_descriptor", editor: { type: autoCompleteEditor }},

Function:
var autoCompleteEditor = function (ui) {
    //debugger;
    var $cell = ui.$cell,
        rowData = ui.rowData,
        dataIndx = ui.dataIndx,
        width = ui.column.width,
        cls = ui.cls;
    var dc = $.trim(rowData[dataIndx]);
     
    var $inp = $("<input type='text' name='" + dataIndx + "' class='" + cls + " pq-ac-editor' />")
        .width(width - 6)
        .appendTo($cell)
        .val(dc);

    $inp.autocomplete({
        source: function( request, response) {
                    $.getJSON($SCRIPT_ROOT +'/fkey_search', { table:'users', srch: request.term }, function( data ) {
                        response( data )
                    });
                 },
        minLength: 2,
        select: function( event, ui ) {
            // this is where I would like to set the id value
            // alert(( ui.item.id ));
        }
       
    }).focus(function () {
        //open the autocomplete upon focus
        // Paramvir - this gives me an error message
        //$(this).data("autocomplete").search($(this).val());
    });
}

Python:
@app.route('/fkey_search')
def fkeySearch():
  tbl = request.args.get('table', 0, type=str)
  srch = request.args.get('srch', 0, type=str)
  fmt_srch = "%"+ srch +"%"

  if tbl == 'users':
    sql = "select user_id as id, name as value from users where name ilike %s"
  r = query_db(sql, (fmt_srch,))
  json_output = json.dumps(r)
  return json_output   

10
When I create a new record in the grid it does not have a record_id.  My database insert statement creates and returns it.  How do I update the grid with that record_id?

Note: I do not want to refresh the entire grid - only the new record.

11
Help for ParamQuery Pro / Re: Batch Editing - not seeing changes
« on: September 27, 2013, 09:31:59 pm »
It works now.

It seemed to need both recIndx: and location: "remote"

Thanks

12
Help for ParamQuery Pro / Batch Editing - not seeing changes
« on: September 27, 2013, 01:19:52 am »
paramquery-2.0.0/pqgrid.dev.js

The fields are marked as changed

"click": function (evt, ui) {
                          debugger;
                          var changes = $addressGrid.pqGrid("getChanges");
                          //send to server
                          //if saved properly then commit
                          $addressGrid.pqGrid("commit");

The debugger shows the changes object, but inside of it the add, edit, delete are all empty.

What am I missing?
Do you have any examples of how this should work?
Thanks,
Bill

Pages: [1]