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

Pages: [1] 2
1
Help for ParamQuery Pro / Re: load data on button click
« on: January 14, 2014, 12:53:55 am »
That works great. Thanks!

2
Help for ParamQuery Pro / Re: load data on button click
« on: January 13, 2014, 07:35:35 pm »
This is the datamodel for the main grid and shows I am using remote location.
Code: [Select]
  dataModel: {
                dataType: "JSON",
                location: "remote",
                recIndx: "ID",
                url: "/PCA/PCAData",
                getData: function (response) {
                    return { data: response };
                }
            },

I want the grid to not load data when the page loads. After I enter a parameter in an input, I want to click a button and have the parameter sent to the server and get the JSON back and load the grid with data.

I assume I need to remove the data model from the grid declaration and call the data model in the button click like below.

Code: [Select]
       
$('#search').click(function()
        {
            $( "#jsongrid" ).pqGrid("option","dataModel.getData",function( response, textStatus, jqXHR ){});
        });

3
Help for ParamQuery Pro / load data on button click
« on: January 10, 2014, 04:08:49 am »
I want to load data in the grid on button click.
I am using MVC so on button click I get the data from the controller. I need to also refresh the grid so I can load the data. When I click the button which does a GET to the controller, it just sends the JSON to the browser and doesn't load in the grid.
I tried $("#jsongrid").pqGrid('refresh') but it didn't load the data. I also tried refreshDataAndView.

I can probably use jQuery's load method but I must be missing something simple.

4
Perfect, thanks

5
Quote
It can be saved in $detailGrid as $detailGrid.data('rowData') for later use.

I guess I didn't explain what I wanted very well.
I want to get the main grid rowData from the inside the detail grid.

In the main grid I have 
Code: [Select]
init: function (ui) {
                var rowData = ui.rowData,
                    id = rowData["ID"];
               
I want to get this id from inside the addRowDetail($grid) function so I can supply this id from the main(parent) grid to the added row in the detail grid.

I can access gridMain.detailModel.init but am not sure how to access the id variable. I know this is probably due to my lack of JS knowledge.

6
How do I get row data from the main grid from the detail grid?

I tried mainGridData = $('#jsongrid').pqGrid("getRowData", { rowIndxPage: 0 });
but of course I don't have the correct rowIndxPage and I'm not sure how to get it.

7
Help for ParamQuery Pro / Re: Detail grid with edit buttons
« on: January 09, 2014, 01:08:39 am »
You provided the correct solution on both issues. Thanks.

8
Help for ParamQuery Pro / Re: Detail grid with edit buttons
« on: January 08, 2014, 10:21:53 pm »
Ok at helps. I have most of it working now.
I get an error, Object doesn't support property or method 'pqGrid' here as your new example shows.
'this' doesn't know about pqGrid.

Code: [Select]
    var ajaxObj = {
                dataType: "JSON",
                beforeSend: function () {
                    this.pqGrid("showLoading");
                },
                complete: function () {
                    this.pqGrid("hideLoading");
                },
                error: function () {
                    this.pqGrid("rollback");
                }
            };

Also in the nested grid, 'isDirty' is always false. I have track set to true so is there any other setting I need to make?

9
Help for ParamQuery Pro / Re: Detail grid with edit buttons
« on: January 07, 2014, 11:53:44 pm »
I copied the button binding to the detail grid and modified the class names to make sure I am refereeing to the detail buttons.
I copied the function for add, edit, update and delete and renamed them to editRowDetail for example. I now need to refer to the detail grid so I can set it to edit mode etc.
In this function in the demo you have

Code: [Select]

  function editRowDetail(rowIndx) {
               $grid.pqGrid("addClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
                $grid.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
How do I refer to the detail grid here instead of the main grid.

Also in the demo you have
Code: [Select]
            init: function (ui) {
                var rowData = ui.rowData,
                    id = rowData["ID"];
 
                //make a deep copy of gridDetailModel
                var objCopy = $.extend(true, {}, gridDetail);
 
                objCopy.dataModel.url = "/" + id;
                objCopy.dataModel.error = function () {
                    $gridMain.pqGrid("rowInvalidate", {rowData:rowData});
                };
                var $grid = $("<div></div>").pqGrid(objCopy);                   
                return $grid;
            }
Later on in my code I reference the main grid like this

Code: [Select]
            var $grid = $("#jsongrid").pqGrid(gridMain);

I tried to refer to the detail grid using objCopy but that doesn't work.

10
Help for ParamQuery Pro / Re: Detail grid with edit buttons
« on: January 06, 2014, 07:11:45 pm »
When you say the options should not be shared are you saying I should copy the button binding code to the detail grid and rename the css classes? I don't understand the detail model and how it relates to the detail grid.
An example would be very helpful since I am not a javascript expert.

11
Help for ParamQuery Pro / Detail grid with edit buttons
« on: January 01, 2014, 03:13:45 am »
What is the best way to implement this? Should I copy the edit code from my main grid such as the button bindings to the detail model?

12
Yes it was related to case sensitivity. Do you have a demo for a custom sort?

If I upgrade to the pro version will my code remain mostly the same and I can add features later?

13
Help for ParamQuery Grid (free version) / Local sorting ignores new record
« on: December 18, 2013, 08:13:32 pm »
After I add a new record it appears at the bottom of the grid. The local sorting ignores the new record and it remains at the bottom.
Is there a way to either add it to the top or to have the sort work with the new record? I tried to use refresh instead of refreshDataAndView after the push and but it doesn't help.

I do it in this order:
data.push(row)
Add record to database
refreshDataAndView
try to sort new record and it remains at bottom of grid

14
Yes that worked. The browsers must treat that setting differently. Thanks!

15
I am using location: remote in datamodel. I moved the $grid.pqGrid("refreshDataAndView") to the success of the ajax in the add function and it still won't refresh the data. I need to refresh the page. It works in the FF browser.

This is my datamodel

Code: [Select]
       var dataModel = {//define datamodel and get data from server
            cache: true,
            location: "remote",
            paging: "remote",
            sorting: "local",
            sortDir: "down",
            //rPP: 20,
            //rPPOptions: [10, 20, 40],
            dataType: "JSON",
            getUrl: function () {
                return { url: "/PCA/PCAData/" };
            },
            getData: function (dataJSON, textStatus, jqXHR ){
                return { data: dataJSON };
            }
        };

Pages: [1] 2