jQWidgets Forums

jQuery UI Widgets Forums DataTable in filtered dataTable getSelection method is not work properly

This topic contains 8 replies, has 2 voices, and was last updated by  szizso 9 years, 9 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author

  • szizso
    Participant

    Sorry for my English!

    I have a dataTable. I select only one row and add to a listbox. If I filtered the dataTable and select of the filtered datas the getSelection method gives wrong row. (it is not working listbox too, I have to play index vs visibleindex).

    Example:
    row1
    row2

    row111
    row112

    row1000 (not visible, only show first 10 row)

    And than,

    Use filter: (visible filtered rows)
    row111
    row112
    row1000

    I selected row111 the getSelection method gives data of row1
    I selected row112 the getSelection method gives data of row2

    My opinion the correctly work is if give it the visible selecton (real selection).

    thx


    Peter Stoev
    Keymaster

    Hi szizso,

    Filtering does not clear the selection. It should work in that way.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    szizso
    Participant

    Hi Peter!

    I don’t want to clear the selection. The problem isn’t this! Sorry, my English is not good.

    I have a jqxDataTable many rows. I see the first 10 rows. I use filter than I see filtered first 10 row. I click one of them (select).

    I want to get the selected row ( var selection = jqxDataTable(‘getSelection’) ). I get the wrong row ( in selection[0] , I use selectionMode: ‘singleRow’ option)!

    Example (I use pager, visible 3 rows in example):

    row1 (index=0, visibleindex=0)
    row2 (index=1, visibleindex=1)
    row3 (index=2, visibleindex=2)

    not visible (these are second page)

    row4 (index=3)
    row5 (index=4)
    row6 (index=5)

    use filter the result in example:

    row5 (index=4, visibleindex=0)
    row6 (index=5, visibleindex=1)

    Click row5 (select)
    Use getSelection method
    Result is not row5 (index=4)! The result is row1 (index=0)

    I hope so understandable.

    Best,
    Zsolt


    Peter Stoev
    Keymaster

    Hi Zsolt,

    There is no visibleIndex setting in jqxDataTable. The method getSelection returns All Rows which are selected.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    szizso
    Participant

    Hi Peter!

    The method getSelection returns All Rows which are selected. <- It’s the problem. The row(s) is not correct row(s) is after I use filter dataTable (filterable: true, filterMode: ‘default’)!

    This failure is listBox too. ListBox has visibleIndex! I try to explain to failure.

    Example (I use pager, visible 3 rows in example):

    row1 (index=0, visibleindexThisIsOnlyExplain=0)
    row2 (index=1, visibleindexThisIsOnlyExplain=1)
    row3 (index=2, visibleindexThisIsOnlyExplain=2)

    not visible (these are second page)

    row4 (index=3)
    row5 (index=4)
    row6 (index=5)

    use filter the result in example:

    row5 (index=4, visibleindexThisIsOnlyExplain=0)
    row6 (index=5, visibleindexThisIsOnlyExplain=1)

    Click row5 (select)
    Use getSelection method
    Result is not row5 (index=4)! The result is row1 (index=0)

    Why do I get the row which index is 0, If I choose the filtered data first row which index is 4?

    Best,
    Zsolt


    Peter Stoev
    Keymaster

    Hi Zsolt,

    The ListBox has no API called visibleIndex, too. Read the http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxlistbox/jquery-listbox-api.htm. From jqxDataTable, using getSelection you get the Array of selected rows and the Row’s Index does not matter at all. You get an Array of Row Objects and the Array’s Index starts from 0 – always. It does not matter whether you have filtering or sorting or paging, etc. I am sorry if you think that this should work in a different way, but it works in the way I explain you.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    szizso
    Participant

    Hi Peter!

    Look at this pls:

    http://jsfiddle.net/q8vvwuu2/68/

    Select a row and than click the button – it works good

    but,

    – Set filter to “Label”, set “Acer”, do Filter
    – Choose the first row, look at the event message, click the button, look at the getSelection method result.

    This is the bug!

    If you use group on DataTable or ListBox, and use the filter, the getSelection method do not give the correct row!

    Best,
    Zsolt


    Peter Stoev
    Keymaster

    Hi Zsolt,

    Your data does not have unique ID i.e the source object’s “id” setting is missing. Example: http://jsfiddle.net/7k24mvno/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    szizso
    Participant

    thx

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.