Author Topic: sorting formatted numbers in demo not correct  (Read 156 times)

arbyter

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 23
    • View Profile
sorting formatted numbers in demo not correct
« on: January 11, 2019, 03:13:16 pm »
hi
playing around in the demos i encoutered following problem.
Open HTML-Table Demo, sort by column Profits and you will see.

73   Kroger                           60,552.9   958.0
58   Royal Bank of Scotland   71,164.3   9,997.8
64   E.ON                           66,313.2   9,203.7
13   ING Group                  138,235.3   8,958.9
42   Berkshire Hathaway   81,663.0   8,528.0

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 3943
    • View Profile
Re: sorting formatted numbers in demo not correct
« Reply #1 on: January 11, 2019, 03:46:47 pm »
That's just a quick & basic demo on how to convert simple html tables into a grid. you would need to customize script according to your needs.

Please check this demo on sorting.

https://paramquery.com/pro/demos/sorting

arbyter

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: sorting formatted numbers in demo not correct
« Reply #2 on: January 14, 2019, 03:03:47 pm »
I really enjoy the possibility of testing in your site. The better the demo is , the sooner a visitor gets convinced of the quality of the product.
Let me succest a littel enhancement to the table-demo.
 

 $(function () {
        function changeToTable(that) {
            var tbl = $("table.fortune500");                       
            tbl.css("display", "");
            $("#grid_table").pqGrid("destroy");
            $(that).button("option", "label", "Change Table To Grid");
        }
        function changeToGrid(that) {
            var tbl = $("table.fortune500");           
            var obj = $.paramquery.tableToArray(tbl);
            var newObj = { width: 700, height: 400, title: "Grid From Table", flexWidth: true };
            newObj.dataModel = { data: obj.data };
            obj.colModel[3].dataType='float';
            newObj.colModel = obj.colModel;
            newObj.pageModel = { rPP: 20, type: "local" };
            $("#grid_table").pqGrid(newObj);
            $(that).button("option", "label", "Change Grid back to Table");
            tbl.css("display", "none");
        }
        //toggle removed from $ 1.9
        $("#pq-grid-table-btn").button().click(function () {
            if ($("#grid_table").hasClass('pq-grid')) {
                changeToTable(this);
            }
            else {
                changeToGrid(this);
            }
        });
    });