Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
Client Side Value List
posted

Hi,

I want to populate Value List from Javascript. I had already put the post regarding the similar issue. and I got reply from Infragistics also. They gave me the following list. http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=2906
It solved my problem a little.

Now I have one more problem.
I want to populate the number of items in the Value List from Client / JS based on some condition. I am able to get the values from Server using AJAX call but it is not getting displayed in the Value List.

Server Code:
Class create_support_roster:

 [AjaxPro.AjaxMethod()]
    public string[][] jagged()
    {
        string[][] obj = new string[2][];

        obj[0] = new string[63];

        obj[1] = new string[2];

        DataSet ds1 = new DataSet();

        Swap m_swapClass = new Swap();

        m_swapClass.FillShift(ds1);

        obj[0][0] = "OFF";

        obj[0][1] = "HL";

        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
        {
            obj[0][i + 2] = ds1.Tables[0].Rows[i]["shift"].ToString();
        }

        obj[1][0] = "PL";

        obj[1][1] = "OFF";

        return obj;
    }

Note: 1. I am getting 60 rows from DB
           2. obj has all the values from ds1

Client Code/ JS:

function grdRegularRoster_BeforeEnterEditModeHandler(gridName, cellId)
{
    var col = igtbl_getColumnById(cellId);
    var cell = igtbl_getCellById(cellId);
    var vlist = new Array(2);
    var v = create_support_roster.jagged().value;
     
    if (cell.getValue() == "PL")
    {
        vlist[0] = v[0];
        vlist[1] = v[1];

        col.ValueList = vlist;
    }
}

Note: vlist variable contains all the values sent from server i.e. 60 items (it properly shows length = 60)
           Even the data it sent is also correct. I checked it thru alert().

But the when executed <col.ValueList = vlist;> I am getting "undefined" 60 times i.e. 60 Value List items as "undefined". I tried all the combition viz.
1.         col.ValueList = vlist[0];
2.         col.ValueList = vlist[1];
3.         col.ValueList = vlist[0][0];
4.         col.ValueList = vlist[0][1];
5.         col.ValueList = vlist[1][0];
6.         col.ValueList = vlist[1][1];
7.         col.ValueList = v;
and many more......

Not getting expected result...please help!

Thanks & Regards,
Anuj D.Vaijapurkar.