Incase anyone else has trouble with this, my PHP script wasn't returning the correctly formatted data, I was missing the response, status & data part. As per the examples it must be in the format
{
response: {
status: 0,
data: [
{
taskID: "12"
}
]
}
}
Announcement
Collapse
No announcement yet.
X
-
oh, I didn't notice that you were using DataSource, not RestDataSource.
With the latter, you have to return data using RestDataSource protocol: http://www.smartclient.com/#restEditSave
Otherwise, have you seen this sample? http://www.smartclient.com/#xmlEditSave
Leave a comment:
-
Thanks a lot. Changing to fetchDataURL and isc.RestDataSource fetches the data but doesn't display it (shows 'No Items to Display') but at least pressing delete nows point to 'DeleteItem.php', so some progress.
Leave a comment:
-
did you try setting fetchDataURL instead of dataURL?
The docs for dataURL says:
Default URL to contact to fulfill all DSRequests.
Leave a comment:
-
JSON DataSource
I am really struggling with deleting items from a grid, see my code below. Everything loads OK but when I click the 'Delete Selected' button the file that gets fetched (in firefox inspector) is not 'DeleteItem.php' as I would expect but DbaseConnection.php - although the correct parameters are sent. Can anyone suggest some pointers, why would the dataURL be fetched again when I've asked for removeData?
isc.DataSource.create({
ID: "DSToDo",
fields:[
{name:"TaskToDoID", title:"ID", width:50, type:"text"},
{name:"TaskToDoDate", title:"Date"},
{name:"TaskToDoJobNo", title:"Job No"},
{name:"TaskToDoJobTitle", title:"Job Title"}
],
dataFormat: "json",
dataURL: "DbaseConnection.php",
removeDataURL:"DeleteItem.php",
addDataURL:"<notYetSet>",
updateDataURL:"<notYetSet>"
})
isc.ListGrid.create({
ID: "LGtoDo",
width:900, height:300,
dataSource: "DSToDo",
autoFetchData: true,
canEdit: true,
canReorderFields: true
})
isc.IButton.create({
left:340, top:340, title:"Delete Selected",
click: function () {LGtoDo.removeData(LGtoDo.getSelectedRecord());
}
});Tags: None
Leave a comment: