views:

64

answers:

1

When I am using rowSelect and sending the values of column 1 and 2 its not sending the value selected for second rowSelect ...instead only sending all the value of column 1 but not column 2 . ...

my approach:

jQuery("#viewt").click( function(){

    var grid = jQuery("#inventoryInq");
    var ids =grid.jqGrid('getGridParam','selarrrow');
    if (ids.length>0) {
        var names = [];
        for (var i=0, il=ids.length; i < il; i++) {
            var name = grid.jqGrid('getCell', ids[i], 'sku');
            names.push(name);
        }

        $.ajax({
            type: "POST",
            url: "/cpsb/transactionHistory.do",
            data:{
                method:"getTransactionHistory",
                lpn:JSON.stringify(ids),
                sku:JSON.stringify(name)
            },
            dataType: "json",
            success: function(msg){
                alert(msg);
            }

        });
    }

});

I have set key=true for column 1 .

update:1

 jQuery("form#viewform").submit( function(){

         var grid = jQuery("#inventoryInq");
         var id =grid.jqGrid('getGridParam','selrow');
           if (id) { 
             var ret = grid.jqGrid('getRowData',id);
             } 

             url:"/cpsb/transactionHistory.do?method=getTransactionHistory&lpn="+ret.licensePlateNumber+"&sku="+ret.sku;  


          });
A: 

It seems to me, that your error is very easy: you should replace JSON.stringify(name) to JSON.stringify(names).

Oleg
Thank!lol...I missed that minute thing which is creating problem....
paul
how can i use the same code fragment to navigate to next page...with the same button click...its sending data but not navigate to next page
paul
Try to set `window.location.href` to new url.
Oleg
should it goes inside the same block I posted earlier?
paul
@paul: anywhere. If you need somewhere to jump (go) to the next page location you should set `window.location.href` to the new url. Just try it and all will be clear.
Oleg
thanks! it is working
paul
@Oleg is there a way I can carry those data for those 2 column in next page...from this say i will sending lpn, sku and on next page it will fill up the text box with those lpn and sku values and populate the grid...
paul
@paul: It seems to me easier to remove contain of the current page `$("body").empty()` and load (for example with `$("boby").load('urlWithNewBody.htm')`) new contain **on the same page**. In the case all values of JavaScript objects will be stay, but you have to prepare the new body contain for the ajax: no `<html>` or `<header>` or `<boby>`. If the elements exist they will be cut (see http://api.jquery.com/load/).
Oleg
@Oleg I already have a page call transaction view ...and there is a grid on inventory view...now on rowselect i have to pass lpn and sku from inventory page grid and carry those values and store on the transaction view lpn and sku textbox...generally I am doing a ajax call to send those data and window.location.href to navigato to next page once ajax call is made...but displaying those value send from inventory page is kinda headache...since user can directly go to transaction page through navigation manu and type different values for corresponding lpn,sku...
paul
If I want to select only one row at a time and sending the sku and lpn from my above code can i replace selarrrow with selrow
paul
@paul: yes, you can. In the case it would be better to remove `multiselect: true` option of jqGrid.
Oleg
problem solved with this var id =grid.jqGrid('getGridParam','selrow');var ret = grid.jqGrid('getRowData',id);lpn:JSON.stringify(ret.licensePlateNumber), sku:JSON.stringify(ret.sku)
paul
instead of doing .click() i am trying to do like ...posted inside updated section in my question..and put that button inside the form..
paul