Transforming the Grid Picker

12346

Comments

  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    Does removing the code section i posted fix all but firefox for you too? or is it just mine being wierd
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    @David_Morris1, doing that just reverses the logic but the issue remains (just with opposite criteria).
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    I've looked a bit at the code, and there's a few gotcha's and weird behaviors, that I can't really figure out (right now). I'll try to have another look at it at some point, but here what I found out so far:

    There's some different issues, the main one being the recompAngularElement function. First of all, the check for whether $injector is undefined checks on injector and not $injector. Easy fix. But from there on, things start to get weird. I added a bunch on console.log's, to check the $scope and $injector vars. Chrome consistently outputs 'undefined' for both of these, and correctly recompiles angular so the injected ng-show attributes work. Firefox on the other hand outputs the actual objects almost each time, and when it does, the injected conditions does not work. Once in awhile (I was able to provoke this by changing the $scope and $injector variable names to something else), Firefox also outputs 'undefined' for these, and suddenly the new conditions does work.

    I.e. when the browser outputs an undefined $scope and $injector var, the conditions are correctly compiled, but when the browser for some reason outputs the actual objects, it has not compiled the new conditions. Strange.

    Another issue is the addShowHideCriteria function, which checks whether the current ng-show attribute contains compareString, and if not, it assumes the check is on a True/False prompt. This is not correct, as there's other possibilities, which aren't strings or true/false prompts, such as DateTime comparison, int / double comparison, compareQueryResult, and possibly others. For now, I've just commented out the calls to modBoolCriteria, as we are running 8.2.2 anyways.
  • Chris_StelzerChris_Stelzer Premier Partner IT Monkey ✭
    Could someone point out how I could append the Column Name to the display output? This works well, but i'd like it to display like Column Name: Value - Column Name: Value - Column Name: Value. Rather then just Value - Value - Value.

    I have some fields with 10 columns to be displayed and it would be easier if the column names were appended to the output.
  • Magnus_Lundgren1Magnus_Lundgren1 Customer Adept IT Monkey ✭✭
    edited March 2018
    Hi.

    Would it be possible to build this into the toolbox?
    We use it to autofill textboxes with userinformation like Department, Office etc based on the user that start the form
    We then user this as a filter on query prompts to only list for EX applications that user can order. or pass those values to script or runbooks.


    var uidS = session.user.Id;
    $.ajax({
    	url: '/api/V3/User/GetUserRelatedInfoByUserId',  
    	data: {userId: uidS},
    	contentType: 'application/json, text/json',
    	type: "GET",
    	success:function(data) {
    		var data2 = JSON.parse(data);
    		var UserCompany = data2.Company;
    		var UserOffice = data2.Office;
    		var UserEmail = data2.Email;
    		var UserName = data2.UserName;
    		
    		var textareaId = document.getElementsByTagName("textarea")[0].id;
    		try {
    			$(document.getElementById(textareaId).value=UserName);
    		} catch(err){}
    		$(document.getElementById(textareaId).onkeyup(this));
    		var textareaId = document.getElementsByTagName("textarea")[1].id
    		$(document.getElementById(textareaId).value=UserOffice);
    		$(document.getElementById(textareaId).onkeyup(this));
    	}
    });
    
    We also use it to autofill certain prompts with userinfo based on the selection of a query prompt.
    Lets say you want to autofill 2 textboxes with the selected users mail and phone number

    //Get all objects that hold our kendo grids.
    var divGridControls = $("div[data-control=checkboxGridByCriteriaOld");
    
    var thisKendoGrid = $(divGridControls[4]).getKendoGrid();
    
    var kendoGridIndex = 4;
    thisKendoGrid.kendoGridIndex = kendoGridIndex;
    
    //Bind 'Change' event whenever a Grid item is selected.
    thisKendoGrid.bind("change", function (e){
    	//Note to self. the dataBound fires after the rows are returned, and dataBinding fires before. 
    	var thisEventKendoGrid = e.sender;
    
    	var selectedRow = thisEventKendoGrid.select();			
    	var uid = thisEventKendoGrid.dataItem(selectedRow).Id;
    	
    	var UserName = thisEventKendoGrid.dataItem(selectedRow).UserName;
    
    	
    	$.ajax({
    		url: '/api/V3/User/GetUserRelatedInfoByUserId',  
    		data: {userId: uid},
    		contentType: 'application/json, text/json',
    		type: "GET",
    		success:function(data) {
    			var data2 = JSON.parse(data);
    			var email = data2.Email;	
    			var Telephone = data2.BusinessPhone;
    
    			
    			var textareaId = document.getElementsByTagName("textarea")[8].id;
    			$(document.getElementById(textareaId).value=Telephone);
    			$(document.getElementById(textareaId).onkeyup(this));
    			var textareaId = document.getElementsByTagName("textarea")[7].id;
    			try {
    				$(document.getElementById(textareaId).value=email);
    			} catch(err){}
    			$(document.getElementById(textareaId).onkeyup(this));
    		
    		}
    	});
    }); // END Bind 'Change'

    The numbers corespond with that textarea wich makes it a little bit of a hassle to use.

    var textareaId = document.getElementsByTagName("textarea")[7].id;


    But if it could be built into the toolbox it would be easier for anyone without java knowledge to do.
    My javascript knowledge is very limited hence the question :smile: 

    For EX.

    @Autofill {"Userinfo":"Office"}
    Or just a vault
    @Autofill {"Text":"[email protected]
    Or autofill based on selection in an @Autocomplete or queryprompt
    @AutofillFromQuery {"Userinfo":"Office"}





  • Magnus_Lundgren1Magnus_Lundgren1 Customer Adept IT Monkey ✭✭
    Might also have found a bug,
    When im using a boolean as a criteria to show a @Autocomplete it wont show if im also using placeholders for other textprompts in the same form.

    the @autocomplete just wont show...
    if i remove the place holder it shows.





  • Magnus_Lundgren1Magnus_Lundgren1 Customer Adept IT Monkey ✭✭
    We also have function that autofills textprompts based on what value is typed in another textprompt.
    For EX we autofill 2 prompts with cost information when the textprompt for Office is filled with a certain value.

        //Get all objects that hold our kendo grids.
        var divGridControls = $("div[data-control=checkboxGridByCriteriaOld");
    
    for (var i = 0; i < divGridControls.length; i++) {        
    	//Re-get this element as an object.
    	var thisKendoGrid = $(divGridControls[i]).getKendoGrid();
    	
    	var kendoGridIndex = i;
    	thisKendoGrid.kendoGridIndex = kendoGridIndex;
    
    	//Bind 'Change' event whenever a Grid item is selected.
    	thisKendoGrid.bind("change", function (e){
    		//Note to self. the dataBound fires after the rows are returned, and dataBinding fires before. 
    		var thisEventKendoGrid = e.sender;
    			
    		var selectedRow = thisEventKendoGrid.select();			
    		var entry_name = thisEventKendoGrid.dataItem(selectedRow).Office;
    		
    		if (entry_name==="SVO"){
    		   var textareaId = document.getElementsByTagName("textarea")[4].id
    		   $(document.getElementById(textareaId).value="352");
    			$(document.getElementById(textareaId).onkeyup(this));
    		   var textareaId = document.getElementsByTagName("textarea")[5].id
    		   $(document.getElementById(textareaId).value="93380");
    		   $(document.getElementById(textareaId).onkeyup(this));
    		} else {
    		   var textareaId = document.getElementsByTagName("textarea")[4].id
    		   $(document.getElementById(textareaId).value="");
    		   var textareaId = document.getElementsByTagName("textarea")[5].id
    		   $(document.getElementById(textareaId).value="");
    		}
    		
    		});
    }

  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    Hi,

    A new idea for this toolbox, the ability to move a checkbox control to the right of the accompanying text and use the required field to require it be either checked or unchecked before the form can be submitted

    for use as a "Please confirm X" for license agreements etc
  • Brian_WinterBrian_Winter Customer Adept IT Monkey ✭✭
    For the @AutoComplete/@MultiSelect controls, is there a way to force the lists to pre-populate?  In some cases, a click into the field will show the result set, other times the list is empty and the user is forced to start typing.
  • Darren_OLearyDarren_OLeary Customer IT Monkey ✭

    Hey guys,

    I stumbled upon this thread and the toolbox through another community thread I posted to.

    I've created a basic form to test some of the functions that I believe I could use in my ROs, in particular the AutoComplete.

    I must be doing something wrong or configured my query list incorrectly as when I enter a string to search, the autocomplete is not filtering and then auto-selecting a match

    My query is configured to list employees and show their name, position and employee ID.

    When I enter a string of text to begin searching, the text field displays the moving '...', then returns a complete list of all employees rather than a filtered list of employees matching the string and highlighting the most appropriate match.


    Any ideas?



    thanks


  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    have you set the filtering on the query field to use the token from the placeholder field which should be directly before it on the ARO ?

  • Darren_OLearyDarren_OLeary Customer IT Monkey ✭
    Got it! Thank you.
  • Brian_WinterBrian_Winter Customer Adept IT Monkey ✭✭
    Our company relies heavily on the fields this toolbox brings to the table.  Hey Cireson, when are you going to incorporate these and/or better? :# Please?
  • Brian_WinterBrian_Winter Customer Adept IT Monkey ✭✭
    When using the multi-select, how come sometimes my prompt text is missing?

  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    Also if anyone knows how to fix that uptick in the text box above, that would be awesome :)
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @Brian_Winter ; can you see anything in common for the prompts where the text is missing or does anything show in the browser dev tools ? I've never seen the prompt disappear like that and leave an uptick looking thingy before. although have noticed when using @layout some things don't seem to work 100%

    also a FYI for anyone interested, i'll be uploading a new version in a week or 2, it will include some bug fixes and new options
  • Sean_BeanSean_Bean Customer IT Monkey ✭
    Anyone figure out the uptick in the text box?  In both Chrome and IE I am only receiving the uptick instead of my search results.
  • Darren_OLearyDarren_OLeary Customer IT Monkey ✭

    Hello all,

    I have successfully implemented the @AutoComplete functionality to shortlist employees by the value entered in the linked Text field.

    With a standard configuration of a Query Result control, where it is configured to display the name and employee ID, a search to short list can be done by either data type, but with the @AutoComplete feature, it only returns results by the employee's name, not by their employee ID.

  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭

    when configuring the query results prompt, the options put into the configure criteria tab will always be used, if you have multiple columns displayed and wish it to search on all of them or even just more than one, it needs to have each field added to the configure criteria, and set to the token of the previous field, ie the one for the placeholder text

  • Darren_OLearyDarren_OLeary Customer IT Monkey ✭

    Thanks Jeff.

    This is how I have it currently configured:

    Prompts:

    Prompts Outputs:

    Prompts Criteria:

    Should I add another Text field in the Prompts for the Employee ID, preceded with another @AutoComplete field and then add an additional criteria to the Query Results for Display Name and set the Token to the Employee ID field?

  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    here is an image of one where we have it filter on the users display name or the username ( had to block out some though)
    You may find that setting some of these up you may need to edit the management pack to ensure the AND's and OR's are in the right place etc
  • Darren_OLearyDarren_OLeary Customer IT Monkey ✭

    Not sure if this is a bug or some weird limitation of my environment...

    I added the @DatePicker to my AROs that have a DatePicker control, but found that the control still had both date and time icons displayed.
    I had to change the control to some other type, save the ARO, then change the control back to a DatePicker for it to work properly.

    Yet, changing existing Text controls using @ToUpperCase or @ToLowerCase worked immediately.

    Has anyone else experienced this with the existing DatePicker controls on their AROs?

  • Darren_OLearyDarren_OLeary Customer IT Monkey ✭

    Resolved my own issue.

    After adding @DatePicker lines in the Prompts, I omitted to move them to the correct positions in the Layout.

    Moved and working as they should have.

  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    edited September 2018
    Is there a possibility to user logged user attribute to @AddDataMergeProperty action ?  Eg. select Hardware Asset only from logged user Department or select Hardware assets which has primary user from the same Department as logged user.
    I try to user @Jeff_Lang @AddDataMergeProperty manual but it don't works.
    I was thinking for another solution to create 50 groups (according to Departments) with CI scoping but I think that this decrease portal performance.
  • Brian_WinterBrian_Winter Customer Adept IT Monkey ✭✭
    Jeff_Lang said:
    @Brian_Winter ; can you see anything in common for the prompts where the text is missing or does anything show in the browser dev tools ? I've never seen the prompt disappear like that and leave an uptick looking thingy before. although have noticed when using @layout some things don't seem to work 100%

    also a FYI for anyone interested, i'll be uploading a new version in a week or 2, it will include some bug fixes and new options

    Hi @Jeff_Lang , any eta on the new version?  Thanks!


  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    Decided i needed a week holiday. I'll be back to work next monday. Should be able to upload it then. And hopefully the uptick won't be so annoying either :)
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Hi, I need some help. I have used combined class "Cireson HardwareAsset Location" and it don't display values from related location - it shows it as "undefined". It shows only atributes from HardwareAsset class. 
    But when I display prompt without @Autocomplete, the location information are displaying?
    Any idea how to fix it?

    Autocomplete empty related class values


    Prompt with shows related class values


  • Peter_NordqvistPeter_Nordqvist Customer Adept IT Monkey ✭✭
    Hi!
    Is it possible to do the following:
    1. I have a Query Result that shows some CI´s
    2. When i select one of the objects, i want to have a textfield that fills information with one of the properties of the selected CI, for example, use Active Directory User as Query Result, when i choose one of the users, i want the textfield to show the Street Address of the user.
  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    FYI - I have just upgraded the Cireson portal to 8.9.4.2016 and the annoying uptick issue appears to be resolved. It is now displaying normally.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    I know I'm late with this one, but consider it an early xmas present now :)

    Latest version from Git-Hub attached

    RO Toobbox changes
    --------------------

        NOTE: The created elements for both the Autocomplete and Multiselect fields have been moved within the code.
                These fields were moved to fix issues when trying to set when to show/hide.
                If you previously targeted these fields you may need to update other code to reflect the change in positioning.
               
        Changed back to using "drawerCreated" to kick off script, instead of the previous "sessionStorageReady"
       
        Fixed some issues which may have caused the DataMerge property not to work correctly on a @AutoComplete
       
        The ARO page is now monitored to ensure hidden fields that have been replaced are set to not required if hidden and required if set to required and visible


        Added new events which can be subscribed to
       
            Events available to be subscribed to:
            -------------------------------------
                A number of events have been added, so that you can use these in other scripts to ensure your scripts do not start too early/late
               
                To subscribe to these events in your scripts use "app.events.subscribe('EventName',FunctionToCall)
               
                The following events are available:
                    ROToolBoxStart : activates as the toobox starts it's processing
                    ROToolBoxSHCStart : activates just before it starts to process the Show/Hide Criteria options
                    ROToolBoxSHCDone : activates just after it finishes processing the Show/Hide Criteria options
                    ROToolBoxACMSStart : activates just before starting to process any @AutoComplete and @MultiSelect options
                    ROToolBoxACMSDone : activates just after finishing all @AutoComplete and @MultiSelect processing
                    ROToolBoxDone : activates once all toolbox actions have completed and the page has been completely rendered

        Additional @ elements
               
            @PreventSelectSelf
            ------------------
           
                When added before a query picker (directly before the query picker, not before the @AutoComplete/@MultiSelect) this will
                remove any returned entries that match with session.user.Id. thus preventing the current user from selecting themselves
                from the list, useful for selecting approvers etc to they cannot select themselves to approve.

            @addAttr
            --------
           
                When added before any standard field, it will add the attribute to the field setting it to the value provided.
                    EG. @addAttr {"Name": "UCD", "Value": "JobTitle"}
               
                This can be useful to set up attributes for other scripts to use/determine exactly which field to select/modify etc.
Sign In or Register to comment.