Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Implement on-click Autocomplete Value While Data Binding in Subgrid - How To?

    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 715
    Answer it
    1. $("#txtautocompid").autocomplete({
    2.  
    3. source: function (request, response) {
    4. debugger;
    5. $.ajax({
    6.  
    7. url: '../WardManagement/WardResultEntry/autocomplete2',
    8. // url: '../WardManagement/WardResultEntry/DietAutocomp',
    9. datatype: "json:",
    10. data: {
    11. Searchtext: $('#txtautocompid').val(),
    12. searchText: request.term,
    13. EatenHabbits: $('#txteatinghabits').val()
    14. },
    15. contentType: "application/json;charset=utf-8",
    16. // dataFilter: function (data) { return data; },
    17. success: function (data) {
    18.  
    19. if (data.length === 0) {
    20.  
    21. }
    22. else {
    23. response(data.slice(0, 10));
    24. }
    25. }
    26.  
    27.  
    28. });
    29. },
    30. minLength: 1,
    31. select: autodata
    32. });
    33. function autodata(e, ui) {
    34. debugger;
    35. $("#id1").val(ui.item.Menuid);
    36. $("#id2").val(ui.item.MenuName);
    37. $("#id3").val(ui.item.Rate);
    38. var a = $("#id1").val();
    39. var b = $("#id2").val();
    40. var c = $("#id3").val();
    41. var Menu_Name = $('#txtautocompid').val();
    42. var length_datatable = $("#subgrid").length;
    43. var aa = $("#doublesubgrid").dataTable().fnGetData();
    44. var sub1 = $("#subgrid").dataTable().fnGetData();
    45. if (sub1 == ''||sub1!=''&&sub1 ) {
    46. var Resulet = 1;
    47. payt();
    48. }
    49. else {
    50. var Result = 2;
    51. }
    52. if (Resulet == 1) {
    53. $("#subgrid").dataTable().fnAddData([a, b, c,
    54. '<input type="image" id="can" class="delete" href="#" src="../Content/img/cancel.png" style="height:25px;width:25px" />'
    55. ]);
    56. payt();
    57. }
    58. else if (Result == 2 )
    59. {
    60. for (var i = 0; i < sub1.length; i++) {
    61. var daa = sub1[i][0];
    62. // if (daa == b) {s
    63. $("#doublesubgrid").dataTable().fnAddData([a, b, c,
    64. '<input type="image" id="can" class="delete" href="#" src="../Content/img/cancel.png" style="height:25px;width:25px" />'
    65. ]);
    66. payt();
    67. // }
    68. }
    69. }
    70. else if (Result == 2) {
    71. for (var i = 0; i < sub1.length; i++) {
    72. var daa = sub1[i][0];
    73. // if (daa == b) {s
    74. $("#doublesubgrid").dataTable().fnAddData([a, b, c,
    75. '<input type="image" id="can" class="delete" href="#" src="../Content/img/cancel.png" style="height:25px;width:25px" />'
    76. ]);
    77. payt();
    78. // }
    79. }
    80.  
    81. }
    82. }
    83. function payt() {
    84. $(a).val("");
    85. $(b).val("");
    86. }

    i am using two same subgrids

    condition is:

    if the autocomplete for example veg soup is clicked that corresponding data rate and and id should bind in first grid..if same veg soup is given again in autocomplete?(without refresh)that should come in next following second grid..if again apple i have given means that should come in first grid ..reapeated values should come in next second grid

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: