Ramkumar Krishnan | 17 Apr 2006 15:40
Picon

Re: getting an error while populating drop down!!

Hi All,
       i missed out the <converter> configuration in dwr.xml. it works fine after adding it.

thanks,
Ramkumar


On 4/17/06, Ramkumar Krishnan <ramkumar.yadav <at> gmail.com> wrote:
Hi,
   I am a newbie to DWR. i am trying to populate a drop down box by returning an object array. I am getting a javascript alert saying [object error].

This is my javascript code.
.......
function populateDepartments()
{
    Helper.getAllDepartments(createList);
}

function createList(data)
{
    DWRUtil.removeAllOptions("dept");
    $("dept").options[$("dept").options.length] = new Option(" ");
    DWRUtil.addOptions("dept", data,"costCenterId", "costCenterName");
}
.......


My Java Code

public class Helper {
....
public DepartmentParam[] getAllDepartments()
    {
        List list = role.getAllDepartments();
        DepartmentParam[] depts = (DepartmentParam[]) list.toArray(new DepartmentParam[list.size()]);
        return depts;
    }
....
}

DepartmentParam has two attributes costCenterId and costCenterName.

Where i am making the mistake?

thanks in advance,
--
Ramkumar

<a href=" http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=65 "><img border="0" alt="Get Firefox!" title="Get Firefox!" src=" http://sfx-images.mozilla.org/affiliates/Buttons/110x32/safer.gif "/></a>



--
Ramkumar Yadav K,

<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=65 "><img border="0" alt="Get Firefox!" title="Get Firefox!" src="http://sfx-images.mozilla.org/affiliates/Buttons/110x32/safer.gif "/></a>
Ramkumar Krishnan | 17 Apr 2006 09:33
Picon

getting an error while populating drop down!!

Hi,
   I am a newbie to DWR. i am trying to populate a drop down box by returning an object array. I am getting a javascript alert saying [object error].

This is my javascript code.
.......
function populateDepartments()
{
    Helper.getAllDepartments(createList);
}

function createList(data)
{
    DWRUtil.removeAllOptions("dept");
    $("dept").options[$("dept").options.length] = new Option(" ");
    DWRUtil.addOptions("dept", data,"costCenterId", "costCenterName");
}
.......


My Java Code

public class Helper {
....
public DepartmentParam[] getAllDepartments()
    {
        List list = role.getAllDepartments();
        DepartmentParam[] depts = (DepartmentParam[]) list.toArray(new DepartmentParam[list.size()]);
        return depts;
    }
....
}

DepartmentParam has two attributes costCenterId and costCenterName.

Where i am making the mistake?

thanks in advance,
--
Ramkumar

<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=65 "><img border="0" alt="Get Firefox!" title="Get Firefox!" src="http://sfx-images.mozilla.org/affiliates/Buttons/110x32/safer.gif "/></a>


Gmane