小编Tom*_*zyk的帖子

TableView,设置可编辑单元格

我尝试使表格单元格可编辑.我设法用两个包含String值的Collumns来做这个,但我不能用表示Integer值的列来实现.

带X的位置是编译器获取错误的位置:

The method setCellFactory(Callback<TableColumn<DataModel,Integer>,TableCell<DataModel,Integer>>) in the type TableColumn<DataModel,Integer> is not applicable for the arguments  (Callback<TableColumn<DataModel,String>,TableCell<DataModel,String>>)
Run Code Online (Sandbox Code Playgroud)

和XX的地方是编译器得到错误的地方:

The method setOnEditCommit(EventHandler<TableColumn.CellEditEvent<DataModel,Integer>>) in the type TableColumn<DataModel,Integer> is not applicable for the arguments ((CellEditEvent<DataModel, Integer> event) -> {})
Run Code Online (Sandbox Code Playgroud)

下面是代码:

public void initialize(URL location, ResourceBundle resources) {
    //Tworzymy sobie kolumny, które b?d? odpowiada? oraz przyjmowa? konretne dane
    TableColumn<DataModel, String> nameColumn = new TableColumn<DataModel, String>("Name");
    nameColumn.setMinWidth(100);
    TableColumn<DataModel, String> surnameColumn = new TableColumn<DataModel, String>("Surname");
    surnameColumn.setMinWidth(100);
    TableColumn<DataModel, Integer> ageColumn = new TableColumn<DataModel, Integer>("Age");
    ageColumn.setMinWidth(100);
    TableColumn<DataModel, Integer> telNumberColumn …
Run Code Online (Sandbox Code Playgroud)

tableview javafx-8

3
推荐指数
1
解决办法
7634
查看次数

如何禁用引导自定义按钮上的悬停效果?

我正在使用 bootstrap 3,这可能是一个愚蠢的问题,但我无法在fa-chart-line此处禁用图标上的悬停效果:

<h5>
  <span class="btn btn-circle blue1-icon"> 
    <i class="fas fa-chart-line"></i>
  </span> My Title
</h5>
Run Code Online (Sandbox Code Playgroud)

CSS:

.blue1-icon {
  background-color: #019993;
  color: #fff;
}

.blue1-icon:hover {
  text-decoration: none;
}

.btn-circle {
  width: 30px;
  height: 30px;
  text-align: center;
  padding: 6px 0;
  font-size: 12px;
  line-height: 1.428571429;
  border-radius: 15px;
}


.btn-circle:hover {
  cursor: default;
  text-decoration: none !important;  
 }


.fa-chart-line:hover  {
  text-decoration: none !important;
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

html css twitter-bootstrap-3

3
推荐指数
1
解决办法
8563
查看次数

ListView,双击选择项目

我有一个主窗口,用户可以通过单击ListView项目来选择程序功能.然而,即使他完全点击项目(白色箭头)程序仍然会激活"数字生成器"功能.我不喜欢那样.

在此输入图像描述

public class MainRootController2 extends Controller implements Initializable {

    @FXML
    StackPane stackPane;
    @FXML
    ListView<String> listView;
    private ObservableList<String> list;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        //making a list and setting a background
        list = FXCollections.observableArrayList("Number Generator", "Cards");
        listView.setBackground(new Background(new BackgroundImage(new Image("MainRootBackground.jpg"),
                BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT,
                BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
        listView.setItems(list);
        listView.getSelectionModel().clearSelection();
    }

    @Override
    public Pane getMainPane() {
        return stackPane;
    }

    /************************ EVENTS *************************/
    @FXML
    private void listViewMouseDoubleClicked(MouseEvent e){
        if(e.getClickCount() > 1){
            String s = listView.getSelectionModel().getSelectedItem();

            switch(s){
                case "Number Generator":
                    ChangeTheRoot change = new …
Run Code Online (Sandbox Code Playgroud)

listview javafx-8

2
推荐指数
1
解决办法
3235
查看次数

TableCell,在TableView中获得位置

如何获得TableCell在类实现中的位置,以便可以执行以下操作:

@Override
public void updateItem(Integer item, boolean empty) {
    super.updateItem(item, empty);

int x = thisCellColumnNumber();
int y = thisCellRowNumber();

if((x == 2) && (y == 3))
   setStyle(".....");
Run Code Online (Sandbox Code Playgroud)

tableview tablecell javafx-8

2
推荐指数
1
解决办法
4711
查看次数

撰写和测序多个史诗终极版可观测

我有一个问题,我不知道如何解决。

我有两个史诗,可以请求api和更新商店:

const mapSuccess = actionType => response => ({
  type: actionType + SUCCESS,
  payload: response.response,
});

const mapFailure = actionType => error => Observable.of({
  type: actionType + FAILURE,
  error,
});

const characterEpic = (action$, store) =>
  action$.ofType(GET_CHARACTER)
    .mergeMap(({ id }) => {
      return ajax(api.fetchCharacter(id))
        .map(mapSuccess(GET_CHARACTER))
        .catch(mapFailure(GET_CHARACTER));
    });

const planetsEpic = (action$, store) =>
  action$.ofType(GET_PLANET)
    .mergeMap(({ id }) => {
      return ajax(api.fetchPlanet(id))
        .map(mapSuccess(GET_PLANET))
        .catch(mapFailure(GET_PLANET));
    });
Run Code Online (Sandbox Code Playgroud)

现在,我有一个简单的场景,在该场景中,我想创建结合了以上两者的第三个动作,我们称之为fetchCharacterAndPlanetEpic。我该怎么做?我认为在很多情况下(对我而言),重要的是在第二个操作开始之前将第一个操作的结果发送到商店。这与Promises和可能是微不足道的redux-thunk,但是我无法以某种方式想出rxjs和and 一起实现的方法redux-observable

谢谢!

javascript rxjs redux redux-observable

2
推荐指数
1
解决办法
2749
查看次数

是否可以将 firebase 的图像上传“uploadTask.on”侦听器变成承诺?

我正在使用 firebase 并注意到大多数方法都返回承诺,但在文档中这不是。是否可以将其变为承诺?

uploadTask.on(
    'state_changed',
    function(snapshot) {
        const progress = snapshot.bytesTransferred / snapshot.totalBytes * 100;
        console.log('Upload is ' + progress + '% done');
    },
    function(error) {
        alert(error);
    },
    function() {
        const downloadURL = uploadTask.snapshot.downloadURL;
        console.log(downloadURL);
    }
);
Run Code Online (Sandbox Code Playgroud)

javascript promise firebase firebase-storage

2
推荐指数
1
解决办法
1153
查看次数

TypeError,captureStream 不是函数

我创建了一个带有视频元素的 HTML5 页面。播放示例视频。在我尝试在视频元素中记录流之后。我正在使用 RecordRTC 库来实现录制功能。我有以下代码

var stream = document.getElementById("my_video").captureStream();
var recorder = RecordRTC(stream, { 
  type: 'video'
});

recorder.startRecording();
Run Code Online (Sandbox Code Playgroud)

录制在 Chrome 浏览器和 Mozilla 浏览器上成功运行,直到版本 57。但在去年 1 月,Mozilla 浏览器更新到版本 58。此更新后,尝试使用 Mozilla 录制视频时出现错误。

错误信息是:

TypeError 
message: document.getElementById("my_video").captureStream is not a function"
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?

html javascript video-recording html5-video recordrtc

2
推荐指数
1
解决办法
3986
查看次数

Vue 中的无限更新循环

我正在尝试编写一个自定义组件。希望我能像这样使用它

let app = new Vue({
    el:'#app',
    template:`
    <tab>
    <tab-item name='1'>
    <h1> This is tab item 1</h1>
    </tab-item>
    <tab-item name='2'>
    <h2> This is tab item 2</h2>
    </tab-item>
    </tab>`,
    components:{
        tab,
        tabItem
    }
})
Run Code Online (Sandbox Code Playgroud)

一切顺利,直到您单击按钮。我从控制台收到一个错误:

[Vue warn]: You may have an infinite update loop in a component render function.

found in

---> <Tab>
       <Root>
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法来解决这个问题,然而,失败总是赢得了调试竞赛。

我怎样才能解决这个问题?

这是我的代码:

let tabItem = {
    props:{
        name:{
            type: String,
            required: true
        }
    },
    render(h){
        let head = this.$slots.head || ''
        let body = this.$slots.default
        let …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component

2
推荐指数
1
解决办法
9015
查看次数

Undefined不是this.setState的函数

我创建了一个简单的登录页面,一旦按下该按钮,就会执行以下功能:

login = (email, password, navigate) => {
  this.setState({ loginButtonPressed: true });
  firebase
    .auth()
    .signInWithEmailAndPassword(email, password)
    .then(function(user) {
      navigate('Profile');
    })
    .catch(function(error) {
      this.setState({ loginButtonPressed: false });
      Alert.alert(error.toString());
    });
};
Run Code Online (Sandbox Code Playgroud)

一旦被调用,它就会执行"this.setState({loginButtonPressed:true})",因为按钮会改变形状(它被标记为按下).但是我得到以下错误:Undefined不是this.setState函数.

怎么解决这个问题?谢谢你的帮助.

javascript firebase reactjs react-native firebase-authentication

2
推荐指数
1
解决办法
1169
查看次数

React-Router 4,带动态路径的重定向

用户收到带有邀请码的电子邮件,例如邀请码http://website.com/invitation/%s在哪里%s.

现在我想在我的应用程序中重定向该URL,但保留邀请代码如:

<Redirect from="/invitation/:code" to="/auth/register/:code" />
Run Code Online (Sandbox Code Playgroud)

因此,当用户点击电子邮件中的链接时:

http://website.com/invitation/2abc433

他将被转移到:

http://website.com/auth/register/2abc433

不幸的是,使用上面的Redirect组件,他被转移到了

http://website.com/auth/register/:code

reactjs react-router

1
推荐指数
1
解决办法
2445
查看次数