Alpha Video Training
Results 1 to 13 of 13

Thread: In Place Editing - filtering one Dropdown based on the value of another...

  1. #1
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default In Place Editing - filtering one Dropdown based on the value of another...

    Hi Brains Trust,

    I am populating the Drop-Downs in an InlineEdit Based on data from a DataCache this works OK for populating the first dropdown... but now I want a cascade filter the 2nd dropdown, as-in, when I select a value in CCode I want the choices in ChargeRate filtered by what I just picked in CCode ... Remembering all this is in InLineEdit.

    NOTE I can do this easily with 2 normal Drop-Down boxes on a UX But I can't figure out how on earth to do this in InplaceEditing in a list.


    Now Populating CCode is done like this

    Code:
    var _onSuccess = function(data) {
    		//create an array from the cache data and re-populate the edit-combo
    		var arrData = data.map(x => Object.values(x));
    		
    		//alert(arrData);
    		var lObj = {dialog.Object}.getControl('lstCHARGES');
    		lObj._inplaceEditing.choices.CCode =  arrData;
    	};
    			
    	
    	var _onFail = function() {};
    	var _filter = '';
    	var _order = {'ChargeCode' : 1};
    	
    	//only get distinct 'ChargeCode' field
    	var obj = {columns: ['ChargeCode'], distinct: true, distinctColumn: 'ChargeCode'};
    	{dialog.object}.getFromDataCache('CdataRates',_onSuccess,_onFail,_filter,_order,obj);

    All good so far.
    Now I select one of the values and I fire the onChange Event,
    The notes say this
    /*
    TIP: This is a system comment that is added automatically every time you edit this code.
    To suppress this system comment, add this comment to your code: //nosystemcomment

    Your code can reference these variables:
    rowNumber - the zero based row number for the event
    newData - the edited data in the List row
    oldData - the data in the List row
    listObj - reference to the List object
    */
    But if I have just selected a choice from the CCode Drop-Down then what is the syntax to get what I just selected
    I thought it would have been newData.CCode... But if I alert() that I get undefined.
    I can't find any documentation on this.
    Please If anyone know how to get the value from an Inline Edit control I would be very grateful.


    Thanks in advance.
    Last edited by kiwibruce; 12-07-2019 at 06:46 PM.

  2. #2
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Here is the crux of my problem, Selwyn shows in this video
    https://www.ajaxvideotutorials.com/V...Runtimeswf.swf
    var lObj = {dialog.object}.getControl('list1');
    if (lObj) {
    lObj._inplaceEditing.choices.Country = ['','alpha','beta',['gamma','g']];
    }
    I can create an array to replace ['','alpha','beta',['gamma','g']]; But how can I retrieve a value from another InplaceEdit control If I want to filter that array?
    Last edited by kiwibruce; 12-07-2019 at 08:56 PM.

  3. #3
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,819

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    It's probably that CCode has been upper cased. Try CCODE.

    However, you may be out of luck in trying to do this... although it does make sense that you should be able to. Alpha doesn't think these things all the way through... they rush stuff... and do not test... and so miss opportunities. It's a feature that is not implemented... in Alpha speak.

    I don't think you can dynamically change values for an inPlace Dropdown control... while the row is being edited... which I believe is what you're trying to do. There is no code that refreshes the DropDown control items.

    If you change the CCODE value... then your onChange code runs. If you then save that row, and then re-edit it, you will see your new ChargeRate items.

    You'll have to get Alpha to review this... and add code to do an inPlace edit refresh. Right now it's only Dynamic at the row edit level... not at the field edit level.
    Last edited by Davidk; 12-08-2019 at 01:04 AM.

  4. #4
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Hi David,

    Thanks for your reply. I will try the Uppercase suggestion otherwise I will Send a request to Alpha.

  5. #5
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,819

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    If you don't get anywhere with Alpha, let me know. The DropDown is a standard HTML Select. You can modify the values yourself.

  6. #6
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Thanks David, The Uppercase thing didn't work so I will create a simple demo for Alpha and send it through and see what happens.

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,819

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Post your sample here as well. The process works for me in as far as I'm not getting any errors.

  8. #8
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    OK I will do that tonight, Thanks David

  9. #9
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Quote Originally Posted by Davidk View Post
    Post your sample here as well. The process works for me in as far as I'm not getting any errors.
    Hi David,

    Thanks for taking a look. Here is the sample UX using static data for the List as well as the Data cache UX_InplaceEdit_Test.zip

    Also here is a video walk through https://www.screencast.com/t/zE79ILVO
    Note: I am using the current Release 6315 - 5397

    Please let me know If I am begin dumb and missing something obvious or it is a case as you suggested, Alpha may have not intended for anyone to do this with Inplace Editing... which is a shame.
    Let me know if you think this is makes sense enough to send through to Selwyn.

    Thanks in advance

  10. #10
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,819

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    The main issue is that Alpha is terrible at documentation... and having other eyes review their work before it's released. I think I'll stop complaining about it though, since everyone seems to be quite happy with the situation.

    There is a problem with your code. In your populateCCodeList function, you are populating your DropdownBox with 1 column... but... you need 2. You need a DisplayValue and a StoredValue.

    Use this code... and you will no longer get an undefined error.

    Code:
    var obj = {columns: ['ChargeCode','ChargeRate'], distinct: true, distinctColumn: 'ChargeCode'};
    In your List Properties, In-place Editing Settings, Before edit start event... you are getting your List control. You don't need to do this... you already have the List Object in 'this'.
    All you need in this event is...

    Code:
    this.populateCCodeList();

  11. #11
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Quote Originally Posted by Davidk View Post
    The main issue is that Alpha is terrible at documentation... and having other eyes review their work before it's released. I think I'll stop complaining about it though, since everyone seems to be quite happy with the situation.

    There is a problem with your code. In your populateCCodeList function, you are populating your DropdownBox with 1 column... but... you need 2. You need a DisplayValue and a StoredValue.

    Use this code... and you will no longer get an undefined error.

    Code:
    var obj = {columns: ['ChargeCode','ChargeRate'], distinct: true, distinctColumn: 'ChargeCode'};
    In your List Properties, In-place Editing Settings, Before edit start event... you are getting your List control. You don't need to do this... you already have the List Object in 'this'.
    All you need in this event is...

    Code:
    this.populateCCodeList();
    Hi David,

    Thanks for the tip about using the this pointer.

    Back to the 2 columns of the drop down I thought you could use just one as all I want is the ChargeCode column, Can I define it as both the stored value as well as the display?

  12. #12
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,819

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    No... there must be 2 distinct columns. I'd call it sloppy programming on Alpha's side. Why should it matter if it's the same column.

    It's a SQL statement so just select the same column twice and give the second one a different field name.

    Also, I forgot to include that you must set up some dummy data in the List In-Place Edit DropdownBox fields. E.g. for ChargeCode, simply put in SP|SP or XX|XX... whatever data you want.

  13. #13
    Member
    Real Name
    Bruce Jonson
    Join Date
    May 2010
    Location
    New Zealand
    Posts
    433

    Default Re: In Place Editing - filtering one Dropdown based on the value of another...

    Quote Originally Posted by Davidk View Post
    No... there must be 2 distinct columns. I'd call it sloppy programming on Alpha's side. Why should it matter if it's the same column.

    It's a SQL statement so just select the same column twice and give the second one a different field name.

    Also, I forgot to include that you must set up some dummy data in the List In-Place Edit DropdownBox fields. E.g. for ChargeCode, simply put in SP|SP or XX|XX... whatever data you want.
    Thanks David, Not sure what we would do without you :)

    I will be sending a request to Alpha for the filtering functionality.

Similar Threads

  1. New In Place Editing of List Control
    By glenschild in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 11-14-2019, 01:06 PM
  2. Lets do what we can do in the in-place editing
    By Pat Bremkamp in forum Mobile & Browser Applications
    Replies: 32
    Last Post: 10-21-2019, 12:50 PM
  3. Replies: 9
    Last Post: 11-30-2013, 11:08 AM
  4. Filter Dropdown Based on Another Dropdown
    By aburningflame in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 10-27-2010, 11:16 AM
  5. Filtering a dropdown?
    By seidel1 in forum Web Application Server v6
    Replies: 3
    Last Post: 08-31-2004, 06:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •