Author Topic: Save sortingDir and Data on roDblclick.  (Read 2048 times)

Fraan83

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 9
    • View Profile
Save sortingDir and Data on roDblclick.
« on: January 17, 2020, 03:00:31 pm »
Hi paramvir,
how can i save the sorting data and sorting dir in navigate url?

for expample:
Code: [Select]
rowDblClick: function (evt, ui) {
    var id_user = ui.rowData.id_user;
    var user_name = ui.rowData.user_name;
    var navigateUrl = "newpage.aspx?id_user=" + id_user + "&username=" + user_name + "&rowIndex=" + ui.rowIndx + "&sortingdata=" + * SORTING COLUMN NAME * + "&sortingdir=" + *SORTING DIR* +";
window.open(navigateUrl, 'new window', 600, 600);

};

thank you so much for your patience

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Save sortingDir and Data on roDblclick.
« Reply #1 on: January 17, 2020, 03:13:53 pm »
All sorting data / information can be obtained from sortModel.sorter option.

https://paramquery.com/pro/api#option-sortModel

Fraan83

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Save sortingDir and Data on roDblclick.
« Reply #2 on: January 24, 2020, 10:09:33 pm »
Ok, thank you parmavir. but now there is another question: how do I load the grid with parameters saved in the qeurystring?
I tried:

 
Code: [Select]
  obj.dataModel = {

                    beforeSend: function () {
                        $(".loadingDiv").show();
                    },
                    complete: function () {
                        $(".loadingDiv").hide();
                    },
                    error: function () {
                        this.rollback();
                    },
                    data: data_grid_anagrafica,
                    location: "local",
                    sorting: "local",
                    space: true,
                    multiKey: null
                };
var sortingDir = *querystring direction variable*;
var sotringData = *querysring dataIndx variable*
obj.dataModel.sortIndx = sortingDir;
obj.dataModel.sortDir = sotringData;
obj.dataModel.data = data_grid;
 $grid = $("div#grid").pqGrid(obj);

but doesn't work for me. Any Idea? thanks.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Save sortingDir and Data on roDblclick.
« Reply #3 on: January 24, 2020, 10:34:40 pm »
In your code, you have incorrectly assigned direction to indx and indx to direction.

Moreover dataModel.sortIndx and dataModel.sortDir are long obsolete, please assign indx and direction to sortModel.sorter option.

Please let me know if you need further help.
« Last Edit: January 24, 2020, 10:37:30 pm by paramvir »