Author Topic: selectionModel not working with Pro v3.2.0  (Read 3842 times)

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
selectionModel not working with Pro v3.2.0
« on: December 29, 2015, 08:54:12 pm »
I'm using the selectionModel to get whole row selection highlight.  Although it is working fine with the eval version, when I switch to pqgrid.min.js Pro version the whole row selection stops working and I only ever get single cell selection.

In the Chrome Console I get the following error...

Uncaught TypeError: Cannot read property '0' of undefined    (at location)   pqgrid.min.js:351

Hyperlinking to the file the following part of line 351 is underlined...

g;t&&t.pq_rowselect&&b.getRow({rowIndxPage:s}).removeClass(l)}}a=d?f.dataModel.data:g;n=0;for(b=a.length;n<b;n++)if(e=a[n])e.pq_rowselect=void 0};a.isSelected=function(a){var b=

Is it likely that I have done something wrong when switching to the Pro version?  e.g. pointing to the wrong file.  Or is there a known issue with version v3.2.0 of pqgrid.min.js?

I look forward to your advice.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: selectionModel not working with Pro v3.2.0
« Reply #1 on: December 30, 2015, 09:43:11 am »
There is no issue with selectionModel in v3.2.0

It's likely that you have switched older version of trial version with new version of Pro.

Please refer to the migration guide for v3.2.0 and refer to the demos.

http://paramquery.com/pro/upgrade/index

http://paramquery.com/pro/demos/selection_row

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: selectionModel not working with Pro v3.2.0
« Reply #2 on: December 30, 2015, 07:23:51 pm »
Rather than your selection_row demo I am trying to implement your "Multiple Selections" demo.  Here is a sample of your demo code...

        var $grid = $("#grid_rowhover").pqGrid(obj);

        $("input[name='rowhover_hover_radio']").click(function (evt) {
            $grid.pqGrid("setSelection", null);
            var val = $(this).val();
            $grid.pqGrid("option", "hoverMode", val);
        }).click();
        $("input[name='rowhover_sel_radio']").click(function (evt) {
            $grid.pqGrid("setSelection", null);
            var val = $(this).val();
            $grid.pqGrid("option", "selectionModel.type", val);
        });
        $("input[name='rowhover_selmode_radio']").click(function (evt) {
            $grid.pqGrid("setSelection", null);
            var val = $(this).val();
            $grid.pqGrid("option", "selectionModel.mode", val);
        });       

When I use this code I can only get it to work using the Eval version.  If I switch to the purchased version it does not work.  I can also see from your demo page that you are also using the Eval version.  Can you change this demo to show how it works with the purchased pro javascript file?  I've attached a screen snapshot of your demo page with the Eval notice in the bottom right corner.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: selectionModel not working with Pro v3.2.0
« Reply #3 on: December 30, 2015, 08:56:50 pm »
There is no difference in functionality between the commercial licensed files and eval ones provided the files belong to same version.

I rechecked the same demo on my end with the v3.2.0 commercial files and no issue was found.

You have issue somewhere in your implementation, please post a small test case in jsfiddle if you want me to look into it.

http://jsfiddle.net/Ljsnm654/
« Last Edit: December 30, 2015, 08:59:50 pm by paramquery »

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: selectionModel not working with Pro v3.2.0
« Reply #4 on: January 05, 2016, 05:42:53 pm »
Many thanks for your support and fast replies.  Your confirmation gave me encouragement to explore the error.

My investigations showed that I have once again been caught out by using remote data to populate my table.  The .click() used to trigger the hover radio button function is what causes the problem by running code "$grid.pqGrid("setSelection", null);" before the table data is loaded.  This is what creates the error "Uncaught TypeError: Cannot read property '0' of undefined    (at location)   pqgrid.min.js:351" as mentioned in my original post.

It is not clear to me why the eval version doesn't also have this problem.

My solution is to remove the .click() call and simply initialise the grid's hover and selection parameters with the usual grid setup code.  Everything is now working ok.

Thanks again for helping me understand my problem.