Hi Team,
I am using ImageBrowser as a part of editor widget in my screen . I need to delete an image only if it is not used by other resources. I wired the destroy to an action that checks whether its in use or not. If its in use I would return a message saying it could not be deleted .I got stuck on how to return this message to destroy and stop it from deleting the image from the library.
As the documentation says the configuration values will be sent to jquery.Ajax() function I tried using the success and error functions in the destroy configuration but could not handle the request. It always shows up as undefined.This is how I configured my imagebrowser.
01.
imageBrowser: {
02.
path:
"/BroadcastType/"
,
03.
transport: {
04.
read: {
05.
url:
function
() { $(
".k-breadcrumbs.k-textbox"
).css(
'display'
,
'none'
);
return
"../ImageBrowser/Read"
},
06.
type:
"POST"
07.
},
08.
destroy: {
09.
url:
"../ImageBrowser/Destroy"
,
10.
type:
"POST"
,
11.
success:
function
(){},
12.
error:
function
(){}
13.
},
14.
thumbnailUrl:
"../ImageBrowser/Thumbnail"
,
15.
uploadUrl:
"../ImageBrowser/Upload"
,
16.
imageUrl:
"../ImageBrowser/Image?name={0}"
17.
}
18.
}
How to stop image from being destroyed from the library until I get a response from backend?
How to handle any errors while backend execution?
Can we override the callback functions in the destroy configuration or should we deal with them at the transport level?
Any pointer to the right direction will be appreciated .
Thanks,
Ramoji.