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
85
Web Combo Value in Web Grid Cell
posted

Hi folks,

I have a WebGrid set up with a WebCombo as a cell editor so that a user can select a value from the drop down to populate the cell value. I have type ahead set up on the WC and it has been working well.

If you try and type a value that is not in the drop down list, when you click out of the cell it simply blanks the value. Is it possible to modify the WG/WC behaviour to allow a value to be selected from the drop down and also allow a user to type in a value.

I realise what i'm askin kind of goes against having the drop down in the first place but if this can be done it would be very helpful.

I appreciate any help.

Thanks.
Jonny

Parents
No Data
Reply
  • 40
    posted

    Hi Jonny,

    You may have solved this already or not longer need a solution but I thought I would post this solution for others anyway.

    I needed the same functionality, mostly becasue my web combo is using an AJAX call to populate but only on drop down and therefore the combo may not have any rows when the user enters a value.

    Here's how I did it, all clientside java script:

    1. create a global variable var txt = ""
    2. On edit key key up of the web combo:
            function webcombo_EditKeyUp(webComboId){
                txt = document.getElementById("webcombo_input").value;
            }
    3. On After Exit Edit Mode of the web grid:
     function webgrid_AfterExitEditModeHandler(gridName, cellId){

             var col = igtbl_getColumnById(cellId);
      if (col.Key == "webcombocolumn") {  

       var cell = igtbl_getCellById(cellId);

         cell.setValue(txt);
        }               

     }

    Thats it. Hope it gives you what you need.

    Lloyd

Children