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

  • SEARCH
  • Home
  • 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 7489163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:12:32+00:00 2026-05-29T15:12:32+00:00

I am using the dojo enhanced grid and the variable marked myGrid refers to

  • 0

I am using the dojo enhanced grid and the variable marked “myGrid” refers to the grid.

function addtocart() {
        $("#additem").click(function(){
            var myGrid = dojo.byId(dataGrid);
            var ids = [];
            var gridRow = myGrid.selection.getSelected();
            $.each( gridRow, function(i, l){
                ids.push(l.id);
            });
            var registcarturl = "${carturl}" + $("#regCart :selected").val();
            $.get(registcarturl, {instanceIds: ids}, function(data) {
                alert(data);
            });
        });
    }

I am not sure what the string for a serialized array should look like as I can dynamically build any string. I am trying to use the jquery get method as shown in the example

$.get("test.cgi", { name: "John", time: "2pm" },   function(data){     alert("Data Loaded: " + data);   });

I modified the function as follows

    function addtocart() {
        $("#additem").click(function(){
            var myGrid = dojo.byId(dataGrid);
            var ids = "[";
            var gridRow = myGrid.selection.getSelected();
            $.each( gridRow, function(i, l){
                ids = ids + "\"" +l.id +"\"";

                if(i != (gridRow.length -1)){
                    ids = ids + ",";
                };

            });
            ids = ids + "]";
            alert(ids);
            var registcarturl = "${carturl}" + $("#regCart :selected").val();
            $.get(registcarturl, {instanceIds: ids}, function(data) {
                alert(data);
            });
        });
    }

When my data gets to my java controller it tries to parse [“219” as a long and of course a NumberFormatException results. The javascript variable ids looks like this [“219″,”217″,”218″,”195”]

Can someone please offer some guidance.

  • 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-29T15:12:32+00:00Added an answer on May 29, 2026 at 3:12 pm

    Ok so the solution was very very simple. Here it is.

        function addtocart() {
            $("#additem").click(function(){
                var myGrid = dojo.byId(dataGrid);
                var ids = [];
                var gridRow = myGrid.selection.getSelected();
                $.each( gridRow, function(i, l){
                    ids[i] = l.id;
                });
                var registcarturl = "${carturl}" + $("#regCart :selected").val();
                $.get(registcarturl, {"modinstid[]": ids}, function(data) {
                    alert(data);
                });
            });
        }
    

    Look at the get request {"modinstid[]": ids} and the corresponding spring MVC controller is as follows.

    @RequestMapping(value = "addtocart/{cart}", method = RequestMethod.GET) public @ResponseBody
    String addtocart(@PathVariable("cart") Long cart, @RequestParam("modinstid[]") ArrayList<String> instances, Model uiModel) {...Action logic goes here...}
    

    Look at the @RequestParam property of the action arguments

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

Sidebar

Related Questions

I am using DOJO for data grid presentation <div id=grid_log dojoType=dojox.grid.DataGrid store=log structure=window.layout_log queryOptions={deep:true}
I'm using dojo.xhrPost to sent Ajax Requests The call is wrapped by a function
I'm trying to create a DOJO DataGrid populated using a dojo.data.ItemFileReadStore with very simple
I am using dojo datagrid to display my data. When the end user edit
In dojo enhanced grid, is there any way to get the selected columns? Currently
I have a web page displaying data using dojo datagrid. Sometimes, users need to
I have a Dojo-DataGrid which is programatically populated as below : var jsonStore =
I'm using dojo dataGrid, and i need to get the row id. When i
I am trying to create an Enhanced Grid with nested sorting functionality in Dojo
I am stuck with using Dojo to accomplish this. Basically what I am trying

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.