jQuery UI Widgets Forums Grid Set Focus on Cascading Dropdownlist in JqxGrid

This topic contains 11 replies, has 2 voices, and was last updated by  abhagat 10 years, 8 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author

  • abhagat
    Participant

    Hello,

    I have implemented cascading dropdownlist in my grid. So, when I select the value in first dropdownlist, I want to set focus on the dropdownlist in the next column. But somehow, I keep getting “0x800a138f – Microsoft JScript runtime error: ‘me.host’ is null or not an object” error. Below is my code:

    {
    text: ‘Answer’, dataField: ‘Answer’, width: ‘6%’, align: ‘center’, cellsalign: ‘center’, columnType: “dropdownlist”,
    createeditor: function (row, value, editor) {
    editor.jqxDropDownList({ source: answerAdapter, displayMember: ‘answer’, height: 25, valueMember: ‘answer’, autoDropDownHeight: true, placeHolder: “Answer:” }).on(‘change’, function (event) {
    var item = event.args.item;
    if (item.index > 0) {
    //Here, I want to set focus to the next column’s dropdownlist
    $(“#grdQuestionnaire”).jqxGrid(‘setcellvalue’, row, “RespPartyType”, “Resp. Party Type:”);
    }

    });
    }
    },
    {
    text: ‘Resp. Party Type’, dataField: ‘RespPartyType’, width: ‘10%’, align: ‘center’, cellsalign: ‘center’, columnType: “dropdownlist”,
    createeditor: function (row, column, editor) {
    var answer = $(‘#grdQuestionnaire’).jqxGrid(‘getcellvalue’, row, “Answer”);
    if (answer == “No” || answer == “Justified”) {
    //list = [“RACF/CLSC”, “Non CLSC”, “Client”, “Vendor”, “Other”];
    editor.jqxDropDownList({ autoOpen: true, autoDropDownHeight: true, source: respPartyAdapter, displayMember: “value”, valueMember: “key”, height: 25, placeHolder: “Resp. Party Type:” });
    } else {
    editor.jqxDropDownList({ autoDropDownHeight: true, height: 25, source: [], placeHolder: “Resp. Party Type:” });
    }
    }
    },

    Thanks in advance.


    Peter Stoev
    Keymaster

    Hi abhagat,

    1. I don’t see ode for setting focus anywhere.
    2. This is very wrong: $(“#grdQuestionnaire”).jqxGrid(‘setcellvalue’, row, “RespPartyType”, “Resp. Party Type:”); You try to update the value of a cell while the Grid is in edit mode. Don’t do that.
    3. We have working sample for creating cascading DropDowns in jqxGrid – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/cascadingediting.htm?arctic. Please, use the same appraoch.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    abhagat
    Participant

    Thank you for pointing out the better ways.
    Is it possible that I can set focus to next column’s dropdownlist while in edit mode?


    abhagat
    Participant

    Hello Peter,

    {
    text: ‘Answer’, dataField: ‘Answer’, width: ’6%’, align: ‘center’, cellsalign: ‘center’, columnType: “dropdownlist”,
    createeditor: function (row, value, editor) {
    editor.jqxDropDownList({ source: answerAdapter, displayMember: ‘answer’, height: 25, valueMember: ‘answer’, autoDropDownHeight: true, placeHolder: “Answer:” }).on(‘change’, function (event) {
    var item = event.args.item;
    if (item.index > 0) {
    //Here, I want to set the focus to the next column’s dropdownlist

    }

    });
    }
    },

    So, how would you suggest that I can focus the dropdownlist in the next column to focus, on selection of dropdownlist in the first column. I am sorry, but the ‘focus’ event I found doesn’t work here.

    Thank you.


    Peter Stoev
    Keymaster

    Hi abhagat,

    What do you understand by focus a next column ? Open the next column’s editor, select the next column’s cell or something else? If you want any of these, then you can simply use the begincelledit or selectcell methods.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    abhagat
    Participant

    Peter,
    That is very helpful.
    However, when I use begincelledit on column editor’s dropdownlist change event, it throws this error “0x800a138f – Microsoft JScript runtime error: ‘me.host’ is null or not an object.” What am I doing wrong here?
    {
    text: ‘Answer’, dataField: ‘Answer’, width: ‘6%’, align: ‘center’, cellsalign: ‘center’, columnType: “dropdownlist”,
    createeditor: function (row, value, editor) {
    editor.jqxDropDownList({ autoOpen: true, source: answerAdapter, displayMember: ‘answer’, height: 25, valueMember: ‘answer’, autoDropDownHeight: true, placeHolder: “Answer:” }).on(‘change’, function (event) {
    var item = event.args.item;
    if (item.label != ‘Yes’) {
    $(“#grdQuestionnaire”).jqxGrid(‘begincelledit’, row, “RespPartyType”);
    }
    });
    }
    },
    {
    text: ‘Resp. Party Type’, dataField: ‘RespPartyType’, width: ‘10%’, align: ‘center’, cellsalign: ‘center’, columnType: “dropdownlist”,
    createeditor: function (row, column, editor) {
    var answer = $(‘#grdQuestionnaire’).jqxGrid(‘getcellvalue’, row, “Answer”);
    if (answer == “No” || answer == “Justified”) {
    editor.jqxDropDownList({ autoOpen: true, autoDropDownHeight: true, source: respPartyAdapter, displayMember: “value”, valueMember: “key”, height: 25, placeHolder: “Resp. Party Type:” });
    } else {
    var defaultValue = new Array();
    editor.jqxDropDownList({ autoDropDownHeight: true, height: 25, disabled: true, source: defaultValue, placeHolder: “Resp. Party Type:” });
    }
    }
    },

    Thank you.


    Peter Stoev
    Keymaster

    Hi abhagat,

    That is so, because “begincelledit” opens an editor and it looks like that you try to call the method while you have an already opened editor and this is incorrect.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    abhagat
    Participant

    Peter,

    The reason I am calling “getcellvalue” method is because I need to get the selected value from the previous column’s dropdownlist. Can you suggest any other method I can get previous column dropdownlist’s selected value without calling “getcellvalue” method? Or any other alternative?

    Thank you


    Peter Stoev
    Keymaster

    Hi abhagat,

    The problem is not the “getcellvalue” method. I did not write that. Please, read my previous post again. The problem is that you try to open an editor while the Grid is already in edit mode. This is wrong.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    abhagat
    Participant

    In this case, the reason I am using “begincelledit” function is because I need to Open the next column’s editor. And, I used that as per your previous post #57530.
    Well, all I want to do is, I have three columns and all have dropdownlist editors. When I select first column editors dropdownlist value, it should open the next columns editor and so on. I tried the method which is already available in the demo but that didn’t work in this situation. Can you offer any alternative or solution?

    Thank you.


    abhagat
    Participant

    Peter,

    Also, my editmode: ‘click’,
    selectionmode: ‘singlerow’

    Let me know if you need any additional information or if these modes are in conflict.

    Thanks.


    abhagat
    Participant

    Peter,

    Can you please explain me about the “0x800a138f – Microsoft JScript runtime error: ‘me.host’ is null or not an object.” error. Because it occurs even when I am not using “begincelledit”. It randomly occurs when I try to go from one editor dropdownlist to another.

    It will be very helpful if I could find out the reason behind this error.

    Thank you

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.