ajpb

Forum Replies Created

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • in reply to: Tip – using jquery UI autocomplete with jqgrid. #100263
    ajpb
    Participant

    Hi,

    I am unable to find your post..

    I am using the latest version of jqGrid, and trying to attach the autoComplete event to 2 fields in the edit Form. The callbacks are called fine, the only problem is the drop down list does not show and is not displayed. Appreciate beyond words can express for your help and any info you can provide. Here is my code:

    I have the autoComplete function attached to the field in the onInitializeForm method (the field whch is defined in my ColModel as PlatformCode_ItemMajor_Code is the one I want it to have autoComplete (I am using ASP.NET MVC 3 using the free version of jqGrid)

    onInitializeForm: function (formId) {

    $(“#PlatformCode_ItemMajor_Code“).autocomplete({

    source: function (request, response) {

    $.ajax({

    url: “/DataManagement/findItemMajors”, type: “POST”, dataType: “json”,

    data: { searchText: request.term, maxResults: 10 },

    success: function (data) {

    response($.map(data, function (item) {

    return { label: item.Code + “:” + item.Name, value: item.Code, id: item.Id }

    }))

    }

    })

    },

    select: function (event, ui) {

    // alert(“ui.item.Id=”+ui.item.id);

    $(“#PlatformCode_ItemMajorId”).val(ui.item.id);

    var str = $(“#PlatformDescription”).val();

    // alert(“str=”+str);

    var substr = str.split(“-“);

    if (substr[1] != null)

    str = ui.item.label.split(':')[1] + “-” + substr[1];

    else

    str = ui.item.label.split(':')[1] + “-“;

    //alert(“str=”+str+”,substr[0]=”+substr[0]+”,str[1]=”+substr[1]+”,ui.item.label.split(':')[1]=”+ui.item.label.split(':')[1]);

    if (substr != null && substr != “” && substr[1] != null && substr[0] != null)

    str = ui.item.label.split(':')[1] + “-” + substr[1];

    $(“#PlatformDescription”).val(str);

    alert(“$(#PlatformDescription)=” + $(“#PlatformDescription”).val());

    }

    });

Viewing 1 replies (of 1 total)

Stay connected with us in your favorite flavor!