Skip to content

Commit fb6d4eb

Browse files
committed
fix: radios in QB sample
1 parent 38b48a5 commit fb6d4eb

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

  • samples/interactions/query-builder/template/src

samples/interactions/query-builder/template/src/index.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -293,33 +293,27 @@ export default class Sample extends React.Component<any, SampleState> {
293293

294294
private buildStatusRadios = (ctx: QueryBuilderSearchValueContext) => {
295295
const implicitValue = ctx.implicit?.value;
296-
const currentValue = implicitValue === null ? '' : implicitValue.toString();
297-
const key = `status-radio-${currentValue}`;
296+
const currentValue = implicitValue == null ? '' : implicitValue.toString();
298297

299298
return (
300299
<IgrRadioGroup
301-
key={key}
302300
style={{ gap: '5px' }}
303-
alignment="horizontal"
304-
value={currentValue}
305-
change={(sender: any) => {
306-
const value = sender.value;
307-
if (value === undefined) return;
308-
309-
const numericValue = Number(value);
310-
if (ctx.implicit.value === numericValue) return;
311-
312-
setTimeout(() => {
313-
ctx.implicit.value = numericValue;
314-
});
315-
}}>
301+
alignment="horizontal">
316302
{this.statusOptions.map(option => (
317303
<IgrRadio
318304
key={option.value}
319305
name="status"
320306
value={option.value.toString()}
321307
checked={option.value.toString() === currentValue}
322-
labelText={option.text}>
308+
onChange={(e: any) => {
309+
if (!e.detail.checked) return;
310+
const numericValue = Number(e.detail.value);
311+
if (ctx.implicit.value === numericValue) return;
312+
setTimeout(() => {
313+
ctx.implicit.value = numericValue;
314+
});
315+
}}>
316+
<span>{option.text}</span>
323317
</IgrRadio>
324318
))}
325319
</IgrRadioGroup>

0 commit comments

Comments
 (0)