Показать сообщение отдельно
Старый 08.11.2013, 09:18   #5  
raz is offline
raz
NavAx
Аватар для raz
NavAx Club
Лучший по профессии 2014
Лучший по профессии 2009
 
1,490 / 1060 (38) ++++++++
Регистрация: 22.07.2003
Адрес: МО
Более сложный вариант, со своим лукапом.
Ваша проблема в fscInventLocationRange.replaceOnLookup(false);

X++:
public class myRunBase extends RunBase
{
    DialogRunBase           dialogRunBase;
    Range                   inventLocationRange;
    FormStringControl       fscInventLocationRange;
....
}

DialogRunbase dialog(DialogRunbase dialog, boolean forceOnClient)
{
    FormGroupControl    fgc;

    dialogRunbase = super(dialog, forceOnClient);
    fgc = dialogRunBase.curFormGroup();

    fscInventLocationRange = fgc.addControl(FormControlType::String, @"InventLocationRange");
    fscInventLocationRange.extendedDataType(extendedTypeNum(InventLocationId));
    fscInventLocationRange.text(inventLocationRange);
    fscInventLocationRange.replaceOnLookup(false);
    fscInventLocationRange.displayLength(50);
    fscInventLocationRange.limitText(250);
...
}

public void dialogPostRun(DialogRunbase _dialog)
{
    if (_dialog.formRun())
    {
        _dialog.formRun().controlMethodOverloadObject(this);
        _dialog.formRun().controlMethodOverload(true);

        fscInventLocationRange = _dialog.formRun().design().control(fscInventLocationRange.id());
    }

    super(_dialog);
}

private void InventLocationRange_lookup()
{
    SysTableLookup          sysTableLookup;
    EmplTable               emplTable = EmplTable::findByUserId_W(curuserid());

    Query                   query     = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    ;
    if (!dialogRunbase)
        return;

    if (fscInventLocationRange)
    {
        sysTableLookup       = SysTableLookup::newParameters(tableNum(InventLocation), fscInventLocationRange);
        queryBuildDataSource = query.addDataSource(tableNum(InventLocation));

        if (emplTable.myInventSite)
        {
            queryBuildDataSource.addRange(fieldNum(InventLocation, InventSiteId)).value(queryValue(emplTable.myInventSite));
        }

        sysTableLookup.addLookupfield(fieldNum(InventLocation, InventLocationId));
        sysTableLookup.addLookupfield(fieldNum(InventLocation, Name));
        sysTableLookup.parmQuery(query);
        sysTableLookup.performFormLookup();
    }
}
За это сообщение автора поблагодарили: Sada (4), G.Menshikh (1), arhat (1), SuperStar88 (1).