Hello, first I'd like to mention that I'm using jQWidgets.
The problem is as follows:
I’m trying to populate a listbox with data from a mysql database. The data is returned from a php file called “problemiOblastData.php” as JSON. The problem is that no data is shown in the listbox.
Now, I’ve discovered that when I change my query string in php file the listbox shows some data.
Original query (not working) is this:
Code:
$query = "SELECT P.ImeDatoteke,P.ProblemId
FROM problem P P,problempripadaoblasti PPO, oblast O
WHERE P.ProblemId = PPO.ProblemId AND PPO.OblastId=O.OblastId
And then I change to this:
Code:
$query = "SELECT P.ImeDatoteke,P.ProblemId
FROM problem P";
Source for the listbox:
Code:
var source4 =
{
async: false,
datatype: "json",
datafields: [
{ name: 'id'},
{ name: 'text' }
],
id: 'id',
url: 'problemiOblastData.php',
processdata: function (data) {
data.selectedOblast = $('#problemiTree').jqxTree('getSelectedItem');
if (data.selectedOblast && data.selectedOblast.parentId != 0) data.selectedOblast = data.selectedOblast.id;
else data.selectedOblast = "0"; // ako nista nije selektovano, ili je selektovan predmet
// alert(data.selected);
}
};
Adapter for the listbox:
Code:
var dataAdapter4 = new $.jqx.dataAdapter(source4);
$("#jqxlistbox2").jqxListBox(
{
source: dataAdapter4,
theme: 'classic',
width: 200,
height: 250,
displayMember: 'text',
valueMember: 'id'
});
I’m binding the data with:
Code:
$('#problemiTree').bind('select', function (event) {
//var item3 = $('#problemiTree').jqxTree('getSelectedItem');
//if (item3 && item3.parentId!=0)
dataAdapter4.dataBind();
//alert(item3.parentId);
});
Please help, thanks.