jQWidgets Forums
jQuery UI Widgets › Forums › Editors › Input, Password Input, TextArea, ColorPicker, Rating, TagCloud, Loader › Input source does not work
This topic contains 5 replies, has 2 voices, and was last updated by Peter Stoev 10 years, 7 months ago.
-
Author
-
hi,
The Source for the jqx Input and the change event doesnot work for the below code. Please help
//script tag
var Asso_source = {
datatype: “json”,
datafields: [
{ name: ‘Asso_ID’},
],url: ‘Controller/method’
};
var Asso_Adapter = new $.jqx.dataAdapter(Asso_source);$(“#Asso_ID”).jqxInput({
placeHolder: “Enter an associate ID”,
height: 25,
width: 199,
source:Asso_Adapter,
displayMember: “Asso_ID”, valueMember: “Asso_ID”,
theme: ‘energyblue’
});
$(‘#Asso_ID’).on(‘change’,function () {
var v = $(‘#Asso_ID’).val();
var url = “/controller/method”;
$.get(url, { Emp_Id: v }, function (data) {
$.each(data, function (i, c) {
$(“#Asso_Name”).val() = c.Asso_Name;
$(“Designation”).val() = c.Grade_Consolidated;
$(“Project_ID”).val() = c.Project_ID;
});
});
});
//body
<table id=”Asso_table” align=”center”>
<tr align=”left”>
<td class=”text”> Associate ID </td> <td/>
<td id=”Asso_Input” >
<input id=”Asso_ID” class=”Input_Box” /></td>
<td/><td class=”text”> Associate_Name </td> <td/>
<td><input id=”Asso_Name” class=”Input_Box” disabled=”disabled” /></td>
<td/>
</tr>
<tr align=”left”>
<td class=”text”>Designation</td> <td/>
<td><input id=”Designation” class=”Input_Box” disabled=”disabled”/></td>
<td/><td class=”text”>Project_ID</td> <td/>
<td ><input id=”Project_ID” class=”Input_Box” disabled=”disabled”/></td>
<td/>
</tr>Hi Sandy,
The “change” event is raised on blur by the HTML Input. The only possible reason for it to not work is that there is some syntax error before your code which binds to that event. I would suggest you to test your code with the Chrome’s debugger or some other debugging tool. Other possible option is missing references to required JavaScript files.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for your quick response. I would check and update. but Could you please tell me why the source is not working?Regards
sandyHi Sandy,
The url “Controller/method” should return JSON data. If it does, the source will work. If it does not, it will not.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comIt returns Json data .
public JsonResult method()
{var dbResult = db.ID.ToList();
var output = from e in dbResultselect new
{
e.Asso_ID,
};return Json(output, JsonRequestBehavior.AllowGet);
}
But it is not working as it shouldHi Sandy,
Ok, prepare and share a jsfiddle.net demo so we would be able to test your scenario, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.