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

Pages: [1]
1
ParamQuery Pro Evaluation Support / Cancel remote paging and filtering
« on: September 20, 2016, 07:50:26 pm »
I have added an alert to the dataModel to cancel going to the next page and filtering if there is unsaved data in the grid.

Code: [Select]
beforeSend: function(jqXHR, settings){
                    if(pageHasChanges){
                        var answer = confirm("Unsaved changes will be lost!");

                        if(!answer){
                            grid.hideLoading();
                            return false;
                        }
}

Everything works correctly except the page number is still incremented even though the paging was canceled. Is there a way to stop the increment from happening?

2
There were actually two issues here.

1. I changed
Code: [Select]
return js.Serialize(dlist);
to
Code: [Select]
return JsonConvert.SerializeObject(dlist, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = "MM/dd/yyyy" });in the SaveChanges() method in the controller.

2. I had to hide the detail column while committing.

3
After the calls to commit() above, pdata still does not have the ID populated for new rows. Additionally, I have a saveChanges method on the detail grid.

Code: [Select]
saveChanges: function (thisGrid) {
                    DoSomething(rowData.ID, thisGrid);
                },

When this is called after the call to commit() on the parent grid, rowData.ID is still undefined for new rows.

4
I'm trying to implement saving of nested grids when the parent grid is saved. The parent row has an identity column that is generated by the db. This column is also a foreign key in the nested grid rows, so I need the value before saving the nested grid. At what point after calling commit() on the parent grid will the identity be populated in the parent row?

Code: [Select]
function saveChanges(){
            //attempt to save editing cell.
            if (grid.saveEditCell() === false) {
                return false;
            }

            if (grid.isDirty() && grid.isValidChange({ focusInvalid: true }).valid) {

                var changes = grid.getChanges({ format: 'byVal' });

                // Save changes to db
                $.ajax({
                    dataType: "json",
                    type: "POST",
                    async: false,
                    beforeSend: function (jqXHR, settings) {
                        grid.showLoading();
                    },
                    url: "SaveChanges",
                    data: { strChanges: JSON.stringify(changes) },
                    success: function (changes) {
                        grid.commit({ type: 'add', rows: changes.addList });
                        grid.commit({ type: 'update', rows: changes.updateList });
                        grid.commit({ type: 'delete', rows: changes.deleteList });

                        grid.history({ method: 'reset' });
                    },
                    complete: function () {
                        grid.hideLoading();
                    }
                });
            }
        }

5
ParamQuery Pro Evaluation Support / Validation on toolbar items
« on: September 14, 2016, 10:05:51 pm »
Is validation possible on toolbar items such as a textbox? I have a textbox that I want to validate by querying a database to see if the value is valid. I can do that in the listener, but am unable to get the error message to show.

Pages: [1]