别想她

文章 评论 浏览 27

别想她 2025-02-21 00:32:30

我认为这里最简单的是隐藏“ on”单击功能上每个父母的所有UL组,因此他们使用“ plus”符号进入开始状态,然后点击仅相应地打开父母,类似的事情:

//Sets tree's to collapsed on init
$('.tree:first-child > ul > li > ul').each(function(event, element){
    $(element).prev().attr('title', 'Expand this branch').find(' > i').removeClass().addClass('fa fa-lg fa-plus-circle');
    $(element).find('> li').hide();
});

$('.tree > ul').attr('role', 'tree').find('ul').attr('role', 'group');

//Tree event on click of span
$('.tree').find('li:has(ul)').addClass('parent_li').attr('role', 'treeitem').find(' > span').attr('title', 'Collapse this branch').on('click', function (e) {

    if($(this).closest('ul').parent().hasClass('tree')){
        //Sets tree parent children to hide and span's to initial state
        $(this).closest('.tree').find(' > ul > li > ul').each(function(event, element){
            $(element).prev().attr('title', 'Expand this branch').find(' > i').removeClass().addClass('fa fa-lg fa-plus-circle');
            $(element).find('> li').hide();
        });
    }

    var children = $(this).parent('li.parent_li').find(' > ul > li');
    var test = $(this).parent('li.parent_li').find(' > ul');
    var parent = $(this).parent('li.parent_li');
    if (children.is(':visible')) {
        children.hide('fast');
        parent.attr('expanded', 'false')
        $(this);
    } else {
        children.show('fast');
        test.attr('style', 'display: grid')
        parent.attr('expanded', 'true')
       
        $(this).attr('title', 'Collapse this branch').find(' > i').removeClass().addClass('fa fa-lg fa-minus-circle');
        
    }
    
    e.stopPropagation();
});

还请记住,您可以将类添加到您的元素中,您可以使用jQuery选择器来处理和管理更好的元素,我不建议您使用一个功能来控制页面中的所有树木,因为它可以真正获得。凌乱,您也可以尝试为了在整个“ on”单击事件之外创建函数,例如:

$('.tree.simple-view').on('click', function(){

});

$('.tree.organizing-view').on('click', function(){

});

这就是为什么在代码上使用 $(this).closest('。tree'),仅影响树您正在单击,否则它将将功能放在树上(左右)。

我还建议仅使用“单语引号”或仅使用“双引号”,并且不要害怕在代码中发表评论:它确实可以帮助人们(以及您)更好地了解正在发生的事情。

I think what's easiest here is to hide all the UL groups belonging to each parent on the "on" click function, so they go to their beginning state with a "plus" sign and then the click just opens the parent accordingly, something like this:

//Sets tree's to collapsed on init
$('.tree:first-child > ul > li > ul').each(function(event, element){
    $(element).prev().attr('title', 'Expand this branch').find(' > i').removeClass().addClass('fa fa-lg fa-plus-circle');
    $(element).find('> li').hide();
});

$('.tree > ul').attr('role', 'tree').find('ul').attr('role', 'group');

//Tree event on click of span
$('.tree').find('li:has(ul)').addClass('parent_li').attr('role', 'treeitem').find(' > span').attr('title', 'Collapse this branch').on('click', function (e) {

    if($(this).closest('ul').parent().hasClass('tree')){
        //Sets tree parent children to hide and span's to initial state
        $(this).closest('.tree').find(' > ul > li > ul').each(function(event, element){
            $(element).prev().attr('title', 'Expand this branch').find(' > i').removeClass().addClass('fa fa-lg fa-plus-circle');
            $(element).find('> li').hide();
        });
    }

    var children = $(this).parent('li.parent_li').find(' > ul > li');
    var test = $(this).parent('li.parent_li').find(' > ul');
    var parent = $(this).parent('li.parent_li');
    if (children.is(':visible')) {
        children.hide('fast');
        parent.attr('expanded', 'false')
        $(this);
    } else {
        children.show('fast');
        test.attr('style', 'display: grid')
        parent.attr('expanded', 'true')
       
        $(this).attr('title', 'Collapse this branch').find(' > i').removeClass().addClass('fa fa-lg fa-minus-circle');
        
    }
    
    e.stopPropagation();
});

Also remember you can add classes to your elements, with which you can handle and manage better your elements with jQuery selectors, I wouldn't recommend either having one single function to control all of your trees in the page, as it can get really messy quickily, also you can try to create functions outside of this whole "on" click event, for example having:

$('.tree.simple-view').on('click', function(){

});

$('.tree.organizing-view').on('click', function(){

});

That's why on the code I used the $(this).closest('.tree'), to only affect the tree you are clicking on, otherwise it will have put the functionality on both trees (left and right).

I would also recommend to use only 'single quotes', or only "double quotes", and don't be afraid to put comments in your code: it really helps people (and also you) understand better what's happening.

TreeView仅允许一个父节点完全扩展

别想她 2025-02-20 20:27:16

您可以使用中间件将属性添加到将传递到不同端点的请求对象中。下面的代码将管理器添加到 req.datesourcemanager ,但这可能是您想要的任何名称。

app.use((req,res,next)=>{
req.datasourceManager = appDataSource.manager
next();
});

编辑以使其与TypeScript一起使用,

将以下内容添加到tsconfig.json

"compilerOptions":{
  "typeRoots": [
    "./src/custom_typings",
    "./node_modules/@types",
  ],
}

并创建以下文件夹/文件:

src
├── custom_typings
│   ├── express
│   │   └── index.d.ts
│   └── index.d.ts

src/custom_typings/index.d.t.ts 是空的在Vscode中。在 src/custom_typings/express/index.d.ts 中添加以下代码:

import { DataSource } from "typeorm";

declare global {
  namespace Express {
    interface Request {
      dataSource: DataSource;
    }
  }
}

You can use a middleware to add properties to the request object that will be passed along to the different endpoints. The code below adds the manager to req.datesourceManager but this could be any name you want.

app.use((req,res,next)=>{
req.datasourceManager = appDataSource.manager
next();
});

Edit to make it work with typescript

Add the following to the tsconfig.json

"compilerOptions":{
  "typeRoots": [
    "./src/custom_typings",
    "./node_modules/@types",
  ],
}

And create following folders/files:

src
├── custom_typings
│   ├── express
│   │   └── index.d.ts
│   └── index.d.ts

The src/custom_typings/index.d.ts is empty but was necessary to get rid of some problems in vscode. In the src/custom_typings/express/index.d.ts add the following but of code:

import { DataSource } from "typeorm";

declare global {
  namespace Express {
    interface Request {
      dataSource: DataSource;
    }
  }
}

将ORM对象传递到Express的路由器

别想她 2025-02-20 12:19:02

函数transformInitData(initdata){return object.fromentries(new urlsearchParams(initdata));} async function valution validate(data,bottoken){const encoder = new textencoder(new textencoder() )=> key!==“哈希”).map((key)=> $ {key} = $ {data [key]} ).sort().join(“ \ n”)const necretkey =等待crypto.subtle.importkey(“ raw”,encoder.encode( 'webappdata'),{name:“ hmac”,hash:“ sha-256”},true,[sign'])const necret =等待crypto.sibtle.sign(“ hmac”,secretkey,encoder.encode(bottoken)const signaturekey =等待crypto.subtle.importkey(“ raw”,necret,{name {name {hmac”,hash:“ sha-256”},是的,[“符号”])const签名=等待crypto.sign.sign(“ hmac”,signaturekey, encoder.encode(checkstring))const hex = [... new Uint8array(signature)]。映射(b => b.tostring(16).padstart(2,'0'))。 data.hash === hex}

function transformInitData(initData) { return Object.fromEntries(new URLSearchParams(initData));} async function validate(data, botToken) { const encoder = new TextEncoder() const checkString = await Object.keys(data) .filter((key) => key !== "hash") .map((key) => ${key}=${data[key]}) .sort() .join("\n") const secretKey = await crypto.subtle.importKey("raw", encoder.encode('WebAppData'), { name: "HMAC", hash: "SHA-256" }, true, ["sign"]) const secret = await crypto.subtle.sign("HMAC", secretKey, encoder.encode(botToken) const signatureKey = await crypto.subtle.importKey("raw", secret, { name: "HMAC", hash: "SHA-256" }, true, ["sign"]) const signature = await crypto.subtle.sign("HMAC", signatureKey, encoder.encode(checkString)) const hex = [...new Uint8Array(signature)].map(b => b.toString(16).padStart(2, '0')).join('') return data.hash === hex }

数据从电报网络应用程序和加密货币验证

别想她 2025-02-20 10:52:47

你不能直接做。您使用的是辅助列。在下面的屏幕截图中,我将以下公式放在 f2 单元格中,以过滤 hr 部门的名称。

=FILTER(A2:A6,B2:B6="HR")

然后将 = f2#作为列表作为数据验证规则。

You can't do it directly. You have use a helper column. In below screenshot I have put following formula to F2 cell to filter names of HR department.

=FILTER(A2:A6,B2:B6="HR")

Then use =F2# to data validation rule as list.

enter image description here

MS Excel-仅在下拉列表中添加选定的值

别想她 2025-02-20 10:46:50

答案由 @vladimir-talybin制作,有一个小问题:

template <class F>
auto cify_no_args(F&& f) {
  static F fn = std::forward<F>(f);
  return [] {
    return fn();
  };
}

也就是说,如果lambda在功能中两次称为lambda,则然后只有第一个调用是有效的,例如,

// only a demo
void call(std::vector<int>& nums) {
  static int i = 0;
  cify_no_args([&]() {
    nums.emplace_back(i++);
  })();
}

int main() {
  std::vector<int> nums1, nums2;
  call(nums1);
  call(nums2);

  std::cout << nums1.size() << std::endl << nums2.size() << std::endl;
}

您将显示 2 0 的输出,这意味着第二个调用 call 函数的函数正在使用第一个呼叫的lambda闭合。

这是因为该解决方案正在使用静态存储封闭的引用,并且一旦存储了引用,即使是新的封闭,它也不会更改。如果关闭会破坏(由于范围不超出范围,或者否则),情况会变得更糟。

我对这个问题的解决方案只是将引用变成指针,并在每次“构造” lambda时更新指针的值:

template <class F>
auto cify_no_args(F&& f) {
  static typename std::remove_reference<F>::type* fn;
  fn = &f;
  return [] {
    return (*fn)();
  };
}

开销是另外两个内存访问,一个用于读取,一个用于写入,但可以确保正确性。

The answer made by @vladimir-talybin has a little problem:

template <class F>
auto cify_no_args(F&& f) {
  static F fn = std::forward<F>(f);
  return [] {
    return fn();
  };
}

That is, if the lambda is called twice in the function, then only the first call is valid, e.g.

// only a demo
void call(std::vector<int>& nums) {
  static int i = 0;
  cify_no_args([&]() {
    nums.emplace_back(i++);
  })();
}

int main() {
  std::vector<int> nums1, nums2;
  call(nums1);
  call(nums2);

  std::cout << nums1.size() << std::endl << nums2.size() << std::endl;
}

You will show the output of 2 and 0, which means that the second call of call function is using the first call's lambda closure.

That's because the solution is using the static to store the closure's reference, and once the reference is stored, it won't be changed, even for a new closure. Things get worse if the closure will get destructed (due to out of scope or else).

My solution of this problem is simply turning the reference into pointer, and update the pointer's value every time we "construct" the lambda:

template <class F>
auto cify_no_args(F&& f) {
  static typename std::remove_reference<F>::type* fn;
  fn = &f;
  return [] {
    return (*fn)();
  };
}

The overhead is two more memory access, one for read and one for write, but ensures the correctness.

C&#x2B;&#x2B;用捕获作为功能指针的lambda

别想她 2025-02-20 08:30:12

如果您的片段调用 getContext()或 getActivity()其中如果您的适配器类中的只需在适配器的cinstructor中传递上下文,则需要此班级示例`
公共类buyerProductApter扩展了RecyClerview.Adapter&lt; buyerProductAdapter.buyerProductViewHolder&gt; gt; {

List<GetProduct.Response> responseList = new ArrayList<>();
Context context;

public BuyerProductAdapter(List<GetProduct.Response> responseList, Context context) {
    this.responseList = responseList;
    this.context = context;
}

}
现在,您可以使用上下文的上下文。

If your in fragment call getContext() or getActivity() where this is required if your in adapter class just pass Context in cinstructor of the adapter class example `
public class BuyerProductAdapter extends RecyclerView.Adapter<BuyerProductAdapter.BuyerProductViewHolder> {

List<GetProduct.Response> responseList = new ArrayList<>();
Context context;

public BuyerProductAdapter(List<GetProduct.Response> responseList, Context context) {
    this.responseList = responseList;
    this.context = context;
}

}
now you can use context where this or Context is required.

如何从主要活动中获取上下文并将其放在Gridlayoutmanager上下文中的其他活动中?

别想她 2025-02-19 22:57:00

根据我对问题的理解,您正在尝试将左侧的内容对齐,并制作 .nav-Master-page-agenty-links 网页的完整宽度。

该片段应该完成工作:

说明:
我刚刚将容器包裹在&lt; div class =“ bg-colorname”&gt;&lt;/div&gt; 以使其 100%的外部容器的100% .container-nav-Master-page-agenty 。这将导致颜色扩展整个页面,然后在 .container 内收缩内容。

.nav-master-page-agency-links {
  height: 40px;
}

.bg-violet {
  background: #F6F8FF 0% 0% no-repeat padding-box;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="hhc-navbar-noshadow  navMasterPageAgency">
  <div class="container-nav-master-page-agency">
    <div class="bg-white">
      <div class="container">
        <div class="row">
          <div class="col-8 d-flex justify-space-between flex-row align-items-center nav-master-page-agency-links">
            <a class="item-menu-famille-metier f1" href="#">Link1</a>
            <a class="item-menu-famille-metier f2 ml-3" href="#">Link2</a>
            <a class="item-menu-famille-metier f3 ml-3" href="#">Link3</a>
          </div>
        </div>
      </div>
    </div>

    <div class="bg-violet py-5">
      <div class="container">
        <div class="row col-lg-1 col-xl-2 pageNameTitle">
          <div class="logo-ma-team">
            <img class="img-fluid" src="https://icons-for-free.com/download-icon-placeholder-1320568685473343206_128.ico" />
          </div>
        </div>
      </div>
    </div>
  </div>
</nav>

Based on my understanding of the question is that you are trying to align the content on the left side and make the .nav-master-page-agency-links full width of the web page.

This snippet should do the job:

Explanation:
I have just wrapped the containers inside a <div class="bg-colorName"></div> to make it 100% of the outer container which is .container-nav-master-page-agency. This will result in making the color expand the whole page and then shrink the content inside the .container.

.nav-master-page-agency-links {
  height: 40px;
}

.bg-violet {
  background: #F6F8FF 0% 0% no-repeat padding-box;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="hhc-navbar-noshadow  navMasterPageAgency">
  <div class="container-nav-master-page-agency">
    <div class="bg-white">
      <div class="container">
        <div class="row">
          <div class="col-8 d-flex justify-space-between flex-row align-items-center nav-master-page-agency-links">
            <a class="item-menu-famille-metier f1" href="#">Link1</a>
            <a class="item-menu-famille-metier f2 ml-3" href="#">Link2</a>
            <a class="item-menu-famille-metier f3 ml-3" href="#">Link3</a>
          </div>
        </div>
      </div>
    </div>

    <div class="bg-violet py-5">
      <div class="container">
        <div class="row col-lg-1 col-xl-2 pageNameTitle">
          <div class="logo-ma-team">
            <img class="img-fluid" src="https://icons-for-free.com/download-icon-placeholder-1320568685473343206_128.ico" />
          </div>
        </div>
      </div>
    </div>
  </div>
</nav>

制作bootstrap col溢出容器

别想她 2025-02-19 19:45:44

如果您查看如何处理查询,则可以推断如何以类似的方式传递其他值(例如主题)。

我首先要重新分配代码,尤其是事件处理程序:

$(document).on("click", ".page-link", function () {
  loadDataByPageNumber($(this).data("page_number"));
});

$("#search_box").keyup(function () {
  loadDataByPageNumber(1);
});

function loadDataByPageNumber(page) {
  var query = $("#search_box").val();
  var subject = $("#subj").val();
  load_data(page, subject, query);
}

然后可以修改 load_data 函数以接受 object> objection 参数:

function load_data(page, subject, query = "") {
  $.ajax({
    url: "fetch.php",
    method: "POST",
    data: { page: page, query: query, subject: subject },
    success: function (data) {
      $("#dynamic_content").html(data);
    },
  });
}

If you take a look at how the query is being handled, you can probably infer how to pass other values (like subject) in a similar manner.

I would start by refactoring the code a bit, especially the event handlers:

$(document).on("click", ".page-link", function () {
  loadDataByPageNumber($(this).data("page_number"));
});

$("#search_box").keyup(function () {
  loadDataByPageNumber(1);
});

function loadDataByPageNumber(page) {
  var query = $("#search_box").val();
  var subject = $("#subj").val();
  load_data(page, subject, query);
}

Then the load_data function can be modified to accept the subject parameter as well:

function load_data(page, subject, query = "") {
  $.ajax({
    url: "fetch.php",
    method: "POST",
    data: { page: page, query: query, subject: subject },
    success: function (data) {
      $("#dynamic_content").html(data);
    },
  });
}

使用PHP AJAX多个值实时搜索

别想她 2025-02-19 12:14:45

要获得所需的表,您应该:

  1. 使用 要通过“ - ”拆分OrderID,
  2. 获取每个子名称的每个子列表的第二个元素
  3. 从每个sublist中删除第二个元素,请使用 sv instanceid_orderid的操作员。

如果表具有以下结构:

t: flip`InstanceID`OrderID`Strategy`Fills!
  (`NG1`NG2`NG3;
  ("hbubuy-ClientName1-2022-07-01";
     "nb8yvce-ClientName2-2022-07-01";
     "cebciube-ClientName3-2022-07-01");
  `VWAP`POV`TWAP;
  5000 300 1000);

下一个查询执行作业:

update
  ClientName: {("-" vs x) 1} each OrderID,
  InstanceID_OrderID: {x: "-" vs x; "-" sv enlist[y],(1#x),2_x}'[OrderID;string InstanceID]
from t

匿名函数

  1. {(“ - ” vs x)1} splits OrderID by by “ - ” 并选择索引1
  2. {x:“ - ” vs x; “ - ” sv enterist [y],(1#x),2_x} splits orderiD by “ - ” ,选择0和2+索引(那里) Q)中的索引操作不删除,预先启动InstanceID并将所有内容连接到“ - ”字符串中

To get desired table you should:

  1. Use vs operator to split OrderID by "-"
  2. Get second element of each sublist for ClientName
  3. Remove second element from each sublist, prepend InstanceID and join new list using sv operator for InstanceID_OrderID.

If the table has following structure:

t: flip`InstanceID`OrderID`Strategy`Fills!
  (`NG1`NG2`NG3;
  ("hbubuy-ClientName1-2022-07-01";
     "nb8yvce-ClientName2-2022-07-01";
     "cebciube-ClientName3-2022-07-01");
  `VWAP`POV`TWAP;
  5000 300 1000);

The next query does the job:

update
  ClientName: {("-" vs x) 1} each OrderID,
  InstanceID_OrderID: {x: "-" vs x; "-" sv enlist[y],(1#x),2_x}'[OrderID;string InstanceID]
from t

where

  1. anonymous function {("-" vs x) 1} splits OrderID by "-" and chooses index 1
  2. {x: "-" vs x; "-" sv enlist[y],(1#x),2_x} splits OrderID by "-", chooses 0 and 2+ indices (there is no remove by index operation in Q), prepends InstanceID and joins everything into "-" delimited string

KDB/Q关于解析字符串和连接的问题

别想她 2025-02-19 12:02:41

要复制类似的行为,您可以使用弹出式

要实现类似的行为,您首先必须禁用 textbox 的内容包装。
然后用 textblock 替换当前 textbox ,该>用于显示文本。
弹出实际上包含Editable textbox ,然后将 textblock 叠加在确切位置,从而隐藏 textblock 使其似乎伸展和覆盖相邻的项目。
MultiTrigger 将在焦点移动 ListBoxItem 之外后立即关闭弹出窗口。

为了提高性能,您应该将 virtualizingstackpanel 用作项目。

<ListView ItemsSource="{Binding MyStringCollection}"
          HorizontalAlignment="Left"
          Width="800">
  <ListView.ItemsPanel>
    <ItemsPanelTemplate>
      <VirtualizingStackPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
  </ListView.ItemsPanel>

  <ListView.ItemTemplate>
    <DataTemplate>
      <Grid>
        <Border BorderThickness="1"
                BorderBrush="Gray">
          <TextBlock Text="{Binding}" />
        </Border>
        <Popup x:Name="EditableTextSiteHost"
               PlacementTarget="{Binding ElementName=TextSite}"
               Placement="Relative"
               Height="{Binding ElementName=TextSite, Path=ActualHeight}"
               AllowsTransparency="True"
               FocusManager.FocusedElement="{Binding ElementName=EditableTextSite}">
          <TextBox x:Name="EditableTextSite"
                   Text="{Binding TextData}" />
        </Popup>
      </Grid>

      <DataTemplate.Triggers>
        <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsSelected}"
                       Value="True" />
            <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsKeyboardFocusWithin}"
                       Value="True" />
          </MultiDataTrigger.Conditions>
          <Setter TargetName="EditableTextSiteHost"
                  Property="IsOpen"
                  Value="True" />
        </MultiDataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>
  </ListView.ItemTemplate>

  <ListView.ItemContainerStyle>
    <Style TargetType="ListBoxItem">

      <!-- Make items overlap -->
      <Setter Property="Margin"
              Value="-2,0,0,0" />
      <Setter Property="Padding"
              Value="0" />
      <Setter Property="Width"
              Value="50" />

      <Style.Triggers>

        <!-- Apply zero Margin on the first item -->
        <DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}"
                     Value="{x:Null}">
          <Setter Property="Margin"
                  Value="0,0,0,0" />
        </DataTrigger>
      </Style.Triggers>
    </Style>
  </ListView.ItemContainerStyle>
</ListView>

托而言,

这只是一个原始的例子,是概念证明。您必须改善行为。例如,当用户滚动或移动 window 时,您需要关闭弹出。否则,由于弹出本身是窗口,因此 popup 不会移动以遵循放置目标。您可以将相关逻辑移至附件的行为。
您可能还想改善选择行为。当前,选择突出显示边框(实际上)并未扩展到围绕弹出窗口。您必须通过在 textbox 上应用边框来模仿此功能,该边框将复制 ListBoxItem 突出显示边框。

To replicate a similar behavior, you can make use of a Popup.

To implement a similar behavior, you first must disable content wrapping of your TextBox.
Then replace the current TextBox with a TextBlock, which is used to display the text.
The Popup, which actually contains the editable TextBox, will then overlay this TextBlock at the exact position, thus hiding the TextBlock to make it appear to stretch and overlay the adjacent items.
A MultiTrigger will close the Popup as soon as the focus moved outside the ListBoxItem.

To improve performance you should use the VirtualizingStackPanel as items host.

<ListView ItemsSource="{Binding MyStringCollection}"
          HorizontalAlignment="Left"
          Width="800">
  <ListView.ItemsPanel>
    <ItemsPanelTemplate>
      <VirtualizingStackPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
  </ListView.ItemsPanel>

  <ListView.ItemTemplate>
    <DataTemplate>
      <Grid>
        <Border BorderThickness="1"
                BorderBrush="Gray">
          <TextBlock Text="{Binding}" />
        </Border>
        <Popup x:Name="EditableTextSiteHost"
               PlacementTarget="{Binding ElementName=TextSite}"
               Placement="Relative"
               Height="{Binding ElementName=TextSite, Path=ActualHeight}"
               AllowsTransparency="True"
               FocusManager.FocusedElement="{Binding ElementName=EditableTextSite}">
          <TextBox x:Name="EditableTextSite"
                   Text="{Binding TextData}" />
        </Popup>
      </Grid>

      <DataTemplate.Triggers>
        <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsSelected}"
                       Value="True" />
            <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsKeyboardFocusWithin}"
                       Value="True" />
          </MultiDataTrigger.Conditions>
          <Setter TargetName="EditableTextSiteHost"
                  Property="IsOpen"
                  Value="True" />
        </MultiDataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>
  </ListView.ItemTemplate>

  <ListView.ItemContainerStyle>
    <Style TargetType="ListBoxItem">

      <!-- Make items overlap -->
      <Setter Property="Margin"
              Value="-2,0,0,0" />
      <Setter Property="Padding"
              Value="0" />
      <Setter Property="Width"
              Value="50" />

      <Style.Triggers>

        <!-- Apply zero Margin on the first item -->
        <DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}"
                     Value="{x:Null}">
          <Setter Property="Margin"
                  Value="0,0,0,0" />
        </DataTrigger>
      </Style.Triggers>
    </Style>
  </ListView.ItemContainerStyle>
</ListView>

To-do

This is just a raw example, a proof of concept. You would have to improve the behavior. For example, you would want to close the Popup when the user scrolls or moves the Window. Otherwise, since Popup itself is a Window, the Popup would not move to follow the placement target. You could move the related logic to an attached behavior.
You likely also want to improve the selection behavior. Currently the selection highlight border does not (virtually) extend to surround the Popup. You have to mimic this by applying a Border on the TextBox that will replicate the ListBoxItem highlight border.

如何强制wpf文本框的内容在其他控件上方类似于Excel单元的其他控件上方显示

别想她 2025-02-19 08:21:30

首先,而不是存储不同的值将其存储在对象中,您需要在将其保存在 localstorage 中之前 Stringfy

节省本地存储

const prefix = document.getElementById("prefix").value;
const fname = document.getElementById("fname").value;
const mname = document.getElementById("mname").value;
const lname = document.getElementById("lname").value;

localStorage.setItem('user', JSON.stringfy({
  prefix: prefix.value,
  fname: fname.value,
  mname: mname.value,
  lname: lname.value
}))

从本地存储中获取数据

document.addEventListener('DOMContentLoaded', () => {
  const userData = JSON.parse(localStorage.getItem('user'))

  document.getElementById('o-prefix').innerText = userData.prefix;
  document.getElementById('o-fname').innerText = userData.fname;
  document.getElementById('o-mname').innerText = userData.mname;
  document.getElementById('o-lname').innerText = userData.lname;
})

Firstly instead of storing different values store it in object like and you need to stringfy before saving it in localStorage.

Saving in Local Storage

const prefix = document.getElementById("prefix").value;
const fname = document.getElementById("fname").value;
const mname = document.getElementById("mname").value;
const lname = document.getElementById("lname").value;

localStorage.setItem('user', JSON.stringfy({
  prefix: prefix.value,
  fname: fname.value,
  mname: mname.value,
  lname: lname.value
}))

Getting Data from Local Storage

document.addEventListener('DOMContentLoaded', () => {
  const userData = JSON.parse(localStorage.getItem('user'))

  document.getElementById('o-prefix').innerText = userData.prefix;
  document.getElementById('o-fname').innerText = userData.fname;
  document.getElementById('o-mname').innerText = userData.mname;
  document.getElementById('o-lname').innerText = userData.lname;
})

如何在DIV中设置值

别想她 2025-02-18 01:24:31

就像Konsolebox建议的那样,如果您只添加 -f 选项,则海报GREP解决方案

grep -v -f file2 file1

实际上可以很好地工作(更快),以将模式视为固定字符串而不是正则表达式。我在我必须比较的一对〜1000行文件列表上验证了这一点。使用 -f ,它花费了0.031 s(真实),而没有将GREP输出重定向到 WC -L 时,它花费了2.278 s(real)。

这些测试还包括 -X 开关,该开关是解决方案的必要部分,以确保在File2包含与一部分但不匹配的一部分(但不全部)的一部分或多个线路的情况下确保完全准确性。文件1。

因此,不需要分类输入的解决方案是快速,灵活的(案例敏感性等)是:

grep -F -x -v -f file2 file1

这与所有版本的GREP不起作用,例如,它在MacOS中失败,其中文件1中的一行将即使是在文件2中不存在,如果它匹配另一个是它的子字符串,则显示为不存在。另外,您可以在macos上安装gnu grep 为了使用此解决方案。

Like konsolebox suggested, the posters grep solution

grep -v -f file2 file1

actually works great (faster) if you simply add the -F option, to treat the patterns as fixed strings instead of regular expressions. I verified this on a pair of ~1000 line file lists I had to compare. With -F it took 0.031 s (real), while without it took 2.278 s (real), when redirecting grep output to wc -l.

These tests also included the -x switch, which are necessary part of the solution in order to ensure totally accuracy in cases where file2 contains lines which match part of, but not all of, one or more lines in file1.

So a solution that does not require the inputs to be sorted, is fast, flexible (case sensitivity, etc) is:

grep -F -x -v -f file2 file1

This doesn't work with all versions of grep, for example it fails in macOS, where a line in file 1 will be shown as not present in file 2, even though it is, if it matches another line that is a substring of it. Alternatively you can install GNU grep on macOS in order to use this solution.

在一个不在另一个文件中找到行的快速方法?

别想她 2025-02-18 00:00:03

重置默认保证金和填充后似乎没有问题:

body {
  margin: 0;
  padding: 0;
}

Seems to be no issue after resetting default margin and padding:

body {
  margin: 0;
  padding: 0;
}

修复用Flexbox制成的NAV栏到页面顶部,但是当您滚动滚动时,请覆盖NAV栏

别想她 2025-02-17 21:39:30

您始终可以捕获JavaScript中的输入,并使用 Parseint 将值转换为整数,并使用正常步骤来控制箭头步进。

使用此方法,您不必担心区分踏脚和输入,因为无论如何这些步骤已经是整数。

let nums = document.querySelectorAll("input[type='number']");

nums.forEach(function(e){
  e.addEventListener("input",function(el){
    el.target.value = parseInt(el.target.value)    
  });
});
<input type="number" step="4" />

You can always capture the input in javascript and convert the values to an integer with parseInt and use the normal step to control the arrow stepping.

With this method you don't have to worry about distinguishing between the stepping and input as the steps will already be integers anyway.

let nums = document.querySelectorAll("input[type='number']");

nums.forEach(function(e){
  e.addEventListener("input",function(el){
    el.target.value = parseInt(el.target.value)    
  });
});
<input type="number" step="4" />

html`&lt;输入类型=“ number”

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文