ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: arbyter on July 05, 2019, 10:54:44 pm

Title: i need a hint
Post by: arbyter on July 05, 2019, 10:54:44 pm
hi
i want to have a picklist that contains all different entrys in current column. I manged it by this snippet.
autocomplete ... source: function (grid,ui){               
                    var ret = []
                    var data=grid.getData({dataIndx:[ui.dataIndx]})
                    $(data).each(function(i,v){if(v[ui.dataIndx])ret.push(v[ui.dataIndx])})
                    return (ret)}
So far, so good.
Now i am stuck with this:
when i leave the field, i should complete with the first matching value found in the list, without the need to choose by key or mousclick.
Example; i enter  a , the list contains Armada, Bravo, Mountain then it should autocomplete with Armada on leaving the field.
Maybe you can provide me a hint.
Title: Re: i need a hint
Post by: arbyter on July 09, 2019, 01:43:23 pm
i change slightly the goal to achieve.
When the user leaves a empty field with Enter Key, then it should fill in the value from the direct neighbour (down) record.

this snippet performs well, but then it clears the injected value on blur
 editorEnd:function(e,ui){if(ui.\$cell.val()==''){
                                                    var id=ui.\$td[0].id.split('-');
                                                    id[4]=parseInt(id[4])+1;
                                                    ui.$cell.text($('#'+id.join('-')).text());
                                                    this.saveEditCell()}                               
                                                                                    },

how can i save the injected value?
Title: Re: i need a hint
Post by: arbyter on July 10, 2019, 10:22:47 pm
after experimenting several hours this snippet does the trick:
    editorKeyDown:function(e,ui){if(e.currentTarget.value=='' && e.keyCode==13){
                                                    var id=ui.$td[0].id.split('-');
                                                    id[4]=parseInt(id[4])+1;
                                                    $('.pq-editor-focus').val($('#'+id.join('-')).text())}                               
                                                                                    }
tried it with events editorEnd and cellBevoreSave, value got allways cleared.