diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js index 81ae26cf6..ca8a763f7 100644 --- a/apps/common/main/lib/view/SearchPanel.js +++ b/apps/common/main/lib/view/SearchPanel.js @@ -115,6 +115,7 @@ define([ this.chCaseSensitive = new Common.UI.CheckBox({ el: $('#search-adv-case-sensitive'), labelText: this.textCaseSensitive, + value: false, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -131,47 +132,12 @@ define([ this.chMatchWord = new Common.UI.CheckBox({ el: $('#search-adv-match-word'), labelText: this.options.matchwordstr || this.textWholeWords, + value: false, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' }); - this.cmbWithin = new Common.UI.ComboBox({ - el: $('#search-adv-cmb-within'), - menuStyle: 'min-width: 100%;', - style: "width: 219px;", - editable: false, - cls: 'input-group-nr', - data: [ - { value: 0, displayValue: this.textSheet }, - { value: 1, displayValue: this.textWorkbook } - ] - }); - - this.cmbSearch = new Common.UI.ComboBox({ - el: $('#search-adv-cmb-search'), - menuStyle: 'min-width: 100%;', - style: "width: 219px;", - editable: false, - cls: 'input-group-nr', - data: [ - { value: 0, displayValue: this.textByRows }, - { value: 1, displayValue: this.textByColumns } - ] - }); - - this.cmbLookIn = new Common.UI.ComboBox({ - el: $('#search-adv-cmb-look-in'), - menuStyle: 'min-width: 100%;', - style: "width: 219px;", - editable: false, - cls: 'input-group-nr', - data: [ - { value: 0, displayValue: this.textFormulas }, - { value: 1, displayValue: this.textValues } - ] - }); - this.buttonClose = new Common.UI.Button({ parentEl: $('#search-btn-close', this.$el), cls: 'btn-toolbar', @@ -181,9 +147,54 @@ define([ this.buttonClose.on('click', _.bind(this.onClickClosePanel, this)); if (window.SSE) { + + this.cmbWithin = new Common.UI.ComboBox({ + el: $('#search-adv-cmb-within'), + menuStyle: 'min-width: 100%;', + style: "width: 219px;", + editable: false, + cls: 'input-group-nr', + data: [ + { value: 0, displayValue: this.textSheet }, + { value: 1, displayValue: this.textWorkbook } + ] + }); + + this.cmbSearch = new Common.UI.ComboBox({ + el: $('#search-adv-cmb-search'), + menuStyle: 'min-width: 100%;', + style: "width: 219px;", + editable: false, + cls: 'input-group-nr', + data: [ + { value: 0, displayValue: this.textByRows }, + { value: 1, displayValue: this.textByColumns } + ] + }); + + this.cmbLookIn = new Common.UI.ComboBox({ + el: $('#search-adv-cmb-look-in'), + menuStyle: 'min-width: 100%;', + style: "width: 219px;", + editable: false, + cls: 'input-group-nr', + data: [ + { value: 0, displayValue: this.textFormulas }, + { value: 1, displayValue: this.textValues } + ] + }); + this.$searchOptionsBlock = $('.search-options-block'); this.$searchOptionsBlock.show(); $('#open-search-options').on('click', _.bind(this.expandSearchOptions, this)); + + if (!this.extendedOptions) { + this.$searchOptionsBlock.addClass('no-expand'); + } + + this.cmbWithin.setValue(0); + this.cmbSearch.setValue(0); + this.cmbLookIn.setValue(0); } } @@ -241,9 +252,18 @@ define([ }; }, + getExtraSettings: function () { + return { + within: !this.cmbWithin.getValue(), + search: !this.cmbSearch.getValue(), + lookIn: !this.cmbLookIn.getValue() + }; + }, + expandSearchOptions: function () { this.extendedOptions = !this.extendedOptions; this.$searchOptionsBlock[this.extendedOptions ? 'removeClass' : 'addClass']('no-expand'); + Common.localStorage.setBool('sse-search-options-extended', this.extendedOptions); }, textFind: 'Find', diff --git a/apps/spreadsheeteditor/main/app/controller/Search.js b/apps/spreadsheeteditor/main/app/controller/Search.js index d9d33bbb2..d9c3a8c0d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Search.js +++ b/apps/spreadsheeteditor/main/app/controller/Search.js @@ -94,9 +94,11 @@ define([ options.asc_setScanForward(d != 'back'); options.asc_setIsMatchCase(opts.matchcase); options.asc_setIsWholeCell(opts.matchword); - //options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked); - //options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); - //options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); + + var extraOptions = this.view.getExtraSettings(); + options.asc_setScanOnOnlySheet(extraOptions.within); + options.asc_setScanByRows(extraOptions.search); + options.asc_setLookIn(extraOptions.lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); if (!this.api.asc_findText(options)) { var me = this; @@ -121,9 +123,11 @@ define([ options.asc_setReplaceWith(opts.textreplace); options.asc_setIsMatchCase(opts.matchcase); options.asc_setIsWholeCell(opts.matchword); - //options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked); - //options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); - //options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); + + var extraOptions = this.view.getExtraSettings(); + options.asc_setScanOnOnlySheet(extraOptions.within); + options.asc_setScanByRows(extraOptions.search); + options.asc_setLookIn(extraOptions.lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); options.asc_setIsReplaceAll(false); this.api.asc_replaceText(options); @@ -137,9 +141,11 @@ define([ options.asc_setReplaceWith(opts.textreplace); options.asc_setIsMatchCase(opts.matchcase); options.asc_setIsWholeCell(opts.matchword); - //options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked); - //options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); - //options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); + + var extraOptions = this.view.getExtraSettings(); + options.asc_setScanOnOnlySheet(extraOptions.within); + options.asc_setScanByRows(extraOptions.search); + options.asc_setLookIn(extraOptions.lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); options.asc_setIsReplaceAll(true); this.api.asc_replaceText(options); @@ -161,9 +167,11 @@ define([ options.asc_setScanForward(true); options.asc_setIsMatchCase(sett.matchcase); options.asc_setIsWholeCell(sett.matchword); - //options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked); - //options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); - //options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); + + var extraOptions = this.view.getExtraSettings(); + options.asc_setScanOnOnlySheet(extraOptions.within); + options.asc_setScanByRows(extraOptions.search); + options.asc_setLookIn(extraOptions.lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); if (!me.api.asc_findText(options)) {