Author Topic: Select Drop Down Will Not Keep Value  (Read 4899 times)

Bawzee

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 11
    • View Profile
Select Drop Down Will Not Keep Value
« on: January 18, 2017, 03:10:53 am »
So I have 1 column as shown:

Code: [Select]
var colM = [
             { title: "Test", width: 130, dataIndx: 0,
                filter: { type: 'textbox', condition: 'begin', listeners: ['keyup'] },
                editor: {
                    type: 'select',
                    options: [,1,2,3,4,5],
                    },
            }
]

When I select the value, it disappears after I tab to a new field.  I've looked at all the example and tried different code, but cannot get it to work.  I'm sure it's something simple I'm missing and there are 2 or 3 lines of code I can add to the column model above to make the value save after tabbing.  Any help is greatly appreciated.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #1 on: January 18, 2017, 06:20:19 am »
Listener property is missing for select editor.

Bawzee

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #2 on: January 18, 2017, 07:52:57 pm »
Thank you for your reply.  It is very much appreciated.  I've been stuck on what will likely turn out to be a very simple issue for a couple of days now and I really need to get it figured out.  I've tried this:

Code: [Select]
{ title: "Test", width: 130, dataIndx: 1,
                filter: { type: 'textbox', condition: 'begin', listeners: ['keyup'] },
                editor: {
                    type: 'select',
                    init: function (ui) {
                       ui.$cell.find("select").pqSelect();
                    },
                    options: [,1,2,3,4,5],
                   
                },
            }

and this:

Code: [Select]
{ title: "Test", width: 130, dataIndx: 1,
                filter: { type: 'textbox', condition: 'begin', listeners: ['keyup'] },
                editor: {
                    type: 'select',
                    options: [,1,2,3,4,5],
                    getData: function (ui) {ui.$cell.find("select").pqSelect();}
                },
            }

but I get the same results, which is the dropdown works and displays ,1,2,3,4,5 and I can select any of the options, but when I tab or click out of the field, the value is blank and the selection does not appear to be retained.

With the exception of this snag, which I understand is likely due something I am doing wrong, I'm loving Paramquery so far and look forward to continuing my evaluation once I figure out how to make the select option work.  I really appreciate any assistance you can provide.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #3 on: January 18, 2017, 09:57:57 pm »
Apparently your shared piece of code looks fine. Can you please share a small test case / jsfiddle so that I can look into it.

Please try to remove extra commas in your code.

Change  options: [,1,2,3,4,5], to  options: [1,2,3,4,5]
« Last Edit: January 18, 2017, 10:02:05 pm by paramquery »

Bawzee

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #4 on: January 20, 2017, 06:51:13 pm »
Yeah, I thought my code appeared correct based on the Demo examples, which made it all the more confusing as to why it does not work.

Before I provide a fiddle, I noticed that there is a pqSelect folder in the Paramquery Pro download that contains pqselect js and css files, yet I saw no indication on this page that these were required dependencies for version 3.3.  http://paramquery.com/pro/tutorial   

Please confirm this is the case.

Thank you.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #5 on: January 20, 2017, 07:56:34 pm »
pqSelect is an add on to enhance functionality of select lists; it's not a required dependency.

Bawzee

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #6 on: January 20, 2017, 09:56:54 pm »
Thank you again for your assistance with this matter. So here is the fiddle:  http://jsfiddle.net/Bawzee/4j6ya0L1/2/

So were starting with a  blank table and will be adding the first record by clicking the Add Domain button.  When I go to edit the row, all fields are editable and retain their data except for the Registrar Select Drop Down.  I'm able to select an option, but when I tab out or click another cell in the data I selected disappears from the Select cell.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #7 on: January 21, 2017, 08:06:18 pm »
Sorry, I was not clear enough in my previous post.

If pqSelect is being used in the code, then pqSelect js and css files need to be included in the document, otherwise not.

I've commented the pqSelect code from your jsfiddle and it works fine now,

http://jsfiddle.net/4j6ya0L1/3/


BTW it's very useful to look at browser console for any errors if something doesn't work as intended.
« Last Edit: January 21, 2017, 08:38:53 pm by paramquery »

Bawzee

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Select Drop Down Will Not Keep Value
« Reply #8 on: January 23, 2017, 07:47:18 pm »
Thank you, sir.  I really appreciate your help with this.