evoluteur / structured-filter

jQuery UI widget for structured queries like "Contacts where Firstname starts with A and Birthday before 1/1/2000 and State in (CA, NY, FL)"...
http://evoluteur.github.io/structured-filter/
MIT License
258 stars 61 forks source link

Exclusive list #11

Open jsmccrumb opened 7 years ago

jsmccrumb commented 7 years ago

It would be nice to have a list but with radio buttons so only one option is ever selected.

Perhaps:

{ type: "exclusiveList", id: "myID", label: "Fancy Exclusive List", list: [
  {id: "opt1", label: "First Option"},
  {id: "opt2", label: "Second Option"},
  {id: "opt3", label: "Third Option"}
]}

And then

case fTypes.exculsiveList:
  var arrayLength = this._field.list.length;
  h+='<span id="value">';
  for (var i = 0; i < arrayLength; i++) {
    h+= EvoUI.inputRadio(this._field.list[i].label, this._field.list[i].id, this._field.list[i].label, v==this._field.list[i].id, 'value' + this._field.list[i].id);
  }
  h +='</span>';
  break;

Haven't looked too deeply into this, I know there would need to be a few more changes to bring this in.