ajax - disable textbox till datatables get populated in javascript -


i getting data datatable through ajax call , having trouble in disabling text-box till datatable populated(either 0 results or more results.) datatable:

tableisasschedulesdetailview = $('#tableisasschedules').datatable({                 "bprocessing": true,                 "deferrender": true,                 "bserverside": false,                 "sservermethod": "post",                 ajax: "/services/json/schedule.aspx?t=is&df=" + date + "&pfjson=" + encodeuri(json.stringify(filters)), "aocolumns": [                     { "sname": "clientid", "bvisible": false, "stitle": "", "mdata": "clientid", "sclass": "cells", "swidth": "0" },                     { "sname": "displayname", "stitle": "client", "mdata": "displayname", "sclass": "cells cell125" }], "fninitcomplete": "fncreatedrow": "fnrowcallback": });} 

this text-box:

<asp:textbox id="date" runat="server"></asp:textbox> 

i want disable text-box till data ajax call(datatable gets populated). tried disabling it: $('#date').prop('disabled',true); called on first line of javascript function calls load datatable. not making change. suggestions?

you disable textbox default, , enable in fndrawcallback. render input as:

<input type="textbox" id="date" disabled="disabled" /> 

then in datatable initialisation:

"fndrawcallback": function (osettings) {     $('#date').removeattr('disabled'); } 

this gets called after every reload of data, have have reapply disabled attribute if that's behaviour you're after. should aware of page lifecycle, if javascript runs before page loaded might explain js disabling issue. have got datatables code in $(document).ready() block?

also, these's strange in code: populating datatable using ajax, yet have "bserverside": false,.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -