Automatically jump to page 1

Automatically jump to page 1

lancwplancwp Posts: 90Questions: 20Answers: 1

My table uses both searchbuilder and inline editing. When the searchbuilder condition is added, for example, inline editing is performed on a line on page 5. After the modification is completed, the page will automatically jump to page 1. What is the reason? Thank's

A few codes

        $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
            editor.inline( this, {
                onBlur: 'submit',
            submit: 'allIfChanged'
            } );
        } )

    .......



         dom: 'QBlfrtip',
            ajax: "controllers/staff.php",

            columns: [
                {
                    data: null,
                    defaultContent: '',
                    className: 'select-checkbox',
                    orderable: false
                },  
                { data: "id" },     
                { data: "ydh" },
                { data: "hppic",
                    render: function ( file_id ) {
                        return file_id ?
                            '<img src="'+editor.file( 'files', file_id ).web_path+'" width="20px"/>' :
                            null;
                    },
                    defaultContent: "",
                    title: "图片"
                },

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    There's no obvious reason, as it's working here without that jump. Could you look at that, please, and see if it helps. If it's still not working for you, please can you link to your page so that we can see the problem.

    Cheers,

    Colin

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    I might know what is happening here. When SearchBuilder is active, it causes a full re-filter to be performed each time.

    If you add pageType: 'page' into your form options object (i.e. the object where you have onBlur being set at the moment), does that stop what you are seeing from happening?

    Keep in mind that this change won't remove the row if there is a filter applied and your change means it should be filtered out...

    Allan

  • lancwplancwp Posts: 90Questions: 20Answers: 1

    I have added pagetype: 'page', but I am still using the searchbuilder condition query. If I finish editing in the line, it will jump to the first page, which should refresh the page automatically.

        $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
                editor.inline( this, {
                    onBlur: 'submit',                       
                submit: 'allIfChanged',
                pageType: 'page'
    
                } );
            } );
    
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    Hi,

    I've just been trying to reproduce the error on this page - but no luck yet.

    If you pop open the console and enter:

    $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
            editor.inline( this, {
                onBlur: 'submit',                       
            submit: 'allIfChanged',
            pageType: 'page'
     
            } );
        } );
    

    That will enable inline editing on the table.

    Then set up a suitable search builder condition - I used Office = San Francisco and put the paging to page 2:

    I can then inline edit a row successfully and it doesn't return the paging back to page 1.

    Can you tell me how to reproduce the error on that page please?

    Allan

  • lancwplancwp Posts: 90Questions: 20Answers: 1

    Thanks for your reply. It's still invalid. I didn't use the server side processing end for processing,After using it, searchbuilder will fail

  • lancwplancwp Posts: 90Questions: 20Answers: 1

    I have used pre asuitable search builder conditio,But it will refresh and jump to the first page after inline editing。

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    I've just tried a modification to the example I linked to above, which has server-side processing disabled.

    Following the same steps as I put up before, I've been unable to reproduce the error. Specifically, this is what I've tried:

    1) Disabled server-side processing in that example
    2) Load the example
    3) In the console enable inline editing:

    $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
            editor.inline( this, {
                onBlur: 'submit',                       
            submit: 'allIfChanged',
            pageType: 'page'
      
            } );
        } );
    

    4) Go to page 2 in the table
    5) Click in a cell and edit a value
    6) Press return
    7) Page 2 is still shown with the updated data.

    Can you give me a link to a test case or instructions on how to reproduce the error please? It would also be worth updating to the latest SearchBuilder and Editor if you haven't already.

    Allan

  • lancwplancwp Posts: 90Questions: 20Answers: 1
    edited November 2021

    Thank Allan,It's OK to follow your steps, but I'm different. I filter before step 4, add search criteria with searchbuilder, and then edit on page 2 of the filter results. After editing, press enter to return to page 1

  • lancwplancwp Posts: 90Questions: 20Answers: 1
    edited November 2021

    Thank Allan,It's OK to follow your steps, but I'm different. I filter before step 4, add search criteria with searchbuilder, and then edit on page 2 of the filter results. After editing, press enter to return to page 1

  • lancwplancwp Posts: 90Questions: 20Answers: 1
    edited November 2021

    When the search criteria are not added, everything is OK

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    Thanks for the clarification - I'm with you now and am also seeing that error. We'll debug this and get back to you.

    Allan

  • lancwplancwp Posts: 90Questions: 20Answers: 1
    edited September 2022

    @allan Hi, do you have a good idea now?

Sign In or Register to comment.