-
14 Mar 2013 3:54 AM #1
using picklist in view to update multiple docs
using picklist in view to update multiple docs
HI all,
is it possible to use the picklist out of button in a view to update multiple documents?
i want to select multiple docs in a view and choose my nab lookup and update all the docs in the view w/ the single user from the nab lookup.
this pops the address book from the view;
var ws = new Ext.nd.UIWorkspace();
var name=ws.pickList({type: "", dbPath : "/names.nsf/", viewName : "SMTSPeople", title : "Notes Address Book Lookup", prompt : "", column :3, multipleSelection : false, useCheckboxSelection : false});
Capture.PNG
-
14 Mar 2013 9:03 PM #2
I'll have to review the code but I believe you get an array of values when you click OK in the address book window. You could take that array, along with the UNIDs of the docs selected and do an Ajax post to an agent on your server that will do what you want. If I have some time over the next few days I'll see if I can give more of a code example.
Jack Ratcliff
Sencha Inc, Green bleeding Senchan
How to report a bug:
http://www.sencha.com/forum/showthre...o-report-a-bug
-
15 Mar 2013 3:17 AM #3
Or Window.open
Or Window.open
Thanks jack...I also tried using this technique: calling the ajax nab picker w/ the window.open...its able to pop the dialog box, but I still can't pass the return value over to my action button, then the js script to update the documents in the view.
the call from the button:
alert("Starting...");
var returnField = "OWNERCOMIT_ID";
var specialParameters = "&db=names.nsf" +"&view=SMTSPeople"+ "&columns=1,2,3" + "&returncol=3" ;
var mywin=window.open("NABPickerSingle?Open&returnfield="+returnField +specialParameters, "popupWindow", "toolbar=no,directories=no,status=no,scrollbars=auto,resizable=yes,resize=yes,menubar=no,height=500,width=800");
handleActOnNAB(returnField, newValue, this);
then using the task handler
which is the same as your handleonTasks demo:
function handleActOnNAB(field, value, actionbar) {
var view = actionbar.getUIView();
var selections = view.getDocuments();
if (selections.length == 0) {
Ext.Msg.alert("Sorry", "You must first select one or more documents before you can perform this action.");
} else {
Ext.Msg.confirm(
"Are you sure?",
"You have selected " + selections.length + " element(s) to change the " + field + " field" + ", are you sure?",
function(answer) {
if (answer == 'yes') {
// build a string of name/value pairs for our value and unids
var p = "field=" + field + "&value=" + value;
// loop over selections and add in the unids
Ext.each(selections, function(item, index, allitems) {
p += "&unid=" + item.unid;
});
// make an ajax post request to our agent
Ext.Ajax.request({
method: 'POST',
url : actionbar.dbPath + 'actOnTasks?openAgent',
success : handleActOnTasksSuccess,
failure : handleActOnTasksFailure,
params : p, // this is our field, value, and unids
extraParams : {
field : field,
value : value
}, // we can put really anything here, I'm adding field and value so we can get to these values in our callback functions
scope : actionbar // set scope to actionbar so our callback function runs as if it was running from the actionbar button
});
}
},
this); // eo Ext.Msg.confirm
} // eo if/then/else
}
-
15 Mar 2013 7:18 AM #4
Figured it out!
Figured it out!
created a shared action and put this in view:
Code:ws = new Ext.nd.UIWorkspace(); var bar = this; ws.pickList({type: "", dbPath : "/names.nsf/", viewName : "SMTSPeople", title : "Address Book Lookup", prompt : "", column :3, multipleSelection : false, useCheckboxSelection : false, callback : handleMyPickList }); // the return of the PickList will be an array of strings function handleMyPickList(arStrings) { var tmp = ""; if (arStrings == null) { ws.prompt('OK', '', 'you clicked cancel'); } else { for (var i=0; i<arStrings.length; i++) { tmp += arStrings[i] ; } handleActOnTasks("OWNERCOMIT_ID", tmp, bar); } }Last edited by jratcliff; 20 Mar 2013 at 6:46 AM. Reason: added [code] tags so the code would be readable
-
20 Mar 2013 6:48 AM #5
Jack Ratcliff
Sencha Inc, Green bleeding Senchan
How to report a bug:
http://www.sencha.com/forum/showthre...o-report-a-bug


Reply With Quote