Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6592641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:34:51+00:00 2026-05-25T17:34:51+00:00

I have my grid with multiselect = true , something likes this , you

  • 0

I have my grid with multiselect = true, something likes this, you can click each checkbox and then delete, when I delete my first row I know the method selarrrow creates and arrays It just delete, but when I want to delete the second row It just never do the delRowData method, and when I select multiple checkbox It just delete the first. I think my method is looping over and over againg each time and never delete at least visually the other row, how can I fix it?? any advise thanks

this is my method:

onSelectRow:function(id) {
    $("#mySelect").change(function (){ 
        if(($("#mySelect option:selected").text()) == 'Deleted') {
            var id = $("#list2").getGridParam('selarrrow');
            for(var i =0; i<id.length;i++) {
                $("#list2").jqGrid('delRowData',id[i]);
        }
    });
}

html

</head>
<body>

<div>
            Move to:
            <select id="mySelect">

            <option value="1">Select and option</option>
            <option value="2">Trash</option>
            <option value="3">Deleted</option>

            </select>
</div>

<table id="list2"></table>
<div id="pager2"></div> 
</body>
</html>

js

$("#Inbox").click(function () {
    $.post('../../view/inbox.html', function (data) {
        $('#panelCenter_1_1').html(data);
        $("#list2").jqGrid({
            url: '../..controller/controllerShowInbox.php',
            datatype: 'json',
            colNames: ['From', 'Date', 'Title', 'Message'],
            colModel: [
                { display: 'From', name: 'name', width: 50, sortable: true, align: 'left' },
                { display: 'Date', name: 'date', width: 150, sortable: true, align: 'left' },
                { display: 'Title', name: 'title', width: 150, sortable: true, align: 'left' },
                { display: 'Message', name: 'message', width: 150, sortable: true, align: 'left' },
            ],
            searchitems: [
                { display: 'From', name: 'name' },
                { display: 'Date', name: 'date' },
                { display: 'Title', name: 'title' },
                { display: 'Message', name: 'message' },
            ],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: '#pager2',
            sortname: 'id_usuario',
            viewrecords: true,
            sortorder: "desc",
            caption: "Inbox",
            multiselect: true,
            multiboxonly: true,
            onSelectRow: function (id) {
                $("#mySelect").change(function () {
                    if (($("#mySelect option:selected").text()) == 'Trash') {
                        var id = $("#list2").getGridParam('selarrrow');
                        if (id != '') {
                            var grid = $("#list2");
                            grid.trigger("reloadGrid");
                            $.post('../../controller/controllerChangeStatus.php', { id: id }, function (data) {
                                $('#panelCenter_2_1').html(data);
                                grid.trigger("reloadGrid");
                            });
                        }
                    } else if (($("#mySelect option:selected").text()) == 'Deleted') {
                        id = $("#list2").getGridParam('selarrrow');
                        if (id != '') {
                            var grid = $("#list2");
                            grid.trigger("reloadGrid");
                            $.post('../../controller/controllerChangeStatus.php', { id: id }, function (data) {
                                $('#panelCenter_2_1').html(data);
                                grid.trigger("reloadGrid");
                            });
                        }
                    } else {
                    }
                });
            }
        });
    });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:34:51+00:00Added an answer on May 25, 2026 at 5:34 pm

    You code looks very strange for me. I can’t explain the effects which you describe without having the demo code, but I could point you to some places in the code which should be rewrote.

    First problem: you use id parameter in the line onSelectRow:function(id) and then use the same variable name id to declare var id = $("#list2").getGridParam('selarrrow');. I don’t understand why you do this. If you don’t need parameter of onSelectRow you can just use onSelectRow:function() which will make the code more clear.

    Second problems: you use binding to change event in $("#mySelect").change, but you use the statement inside of another event onSelectRow. So on every row selection you will have one more event handler to the change event. For example you would replace the body of $("#mySelect").change(function (){ to alert("changed!"). Then you would select two different rows and change the option in the “#mySelect”. You will see two alerts. Then you select another row and change the option in the “#mySelect”. You will see three alerts. And so on.

    So you should rewrote your code in any way. If you will still have the same problem you should include full demo code (including HTML code with <select id="mySelect">...) which can be used to reproduce your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Grid inside a Canvas defined like this: <Canvas x:Name=outerCanvas> <Grid Grid.Row=1
Hai presently i have grid like this. <Grid Name=tGrid1 Grid.Row=0 Background=Black > </Grid> <Grid
I have a multiselect grid where I can get schools.getSelectionModel().getSelection(); there is an object
I have grid like this. How to change index for each element, i.e. to
I have a grid in a XAML file in a WPF project. This MainGrid
I have grid with user data with first column having check box. I have
I have grid which displays users information. I have commandColumn with edit, delete commands.
in my web application i have grid view control with edit property true. Now
I have a grid view displaying the messages a user has. Each message the
I have a grid, when i click on the edit button it goes to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.