GVKun编程网logo

shit layui & select & re-render & bug

16

对于shitlayui&select&re-render&bug感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于***Assertionfailurein-[UITableViewdequeue

对于shit layui & select & re-render & bug感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于*** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot、 <_getSelectedIndex> 的有用信息。

本文目录一览:

shit layui & select & re-render & bug

shit layui & select & re-render & bug

shit layui

https://www.layui.com/doc/modules/form.html#onselect

https://www.layui.com/doc/element/form.html#select

select & re-render bug

form.render("select");


let jsonObj = {};

const editProject = () => {
    let reset = document.querySelector(`button[type="reset"]`);
    layui.use("form", function() {
        let form = layui.form,
            layer = layui.layer;
        // init select
        form.render("select");
        form.on(''submit(formDemo)'', function(data) {
            let {
                user_name,
                role,
                password,
                email,
            } = data.field;
            let query_obj = {
                user_name,
                role,
                password
            };
            // filter
            if (email) {
                query_obj.email = email;
            }
            let url = `${fetchIP}/http/sign/updateuser?${encodeURIComponent(JSON.stringify(query_obj))}`;
            getDatas(url).then(json => {
                // loading
                let loadingIndex = layer.load(1, {
                    time: 1*1000,
                });
                let resetButton = document.querySelector(`button[type="reset"]`);
                setTimeout(() => {
                    layer.close(loadingIndex);
                    if (json.success) {
                        layer.close(modalIndex);
                        swal({
                            title: "修改服务成功!",
                            text: `${json.message !== null ? json.message : "3 秒后自动关闭!"}`,
                            icon: "success",
                            // button: "关闭",
                            buttons: false,
                            timer: 3000,
                        });
                        resetButton.click();
                        loadList();
                    } else {
                        swal({
                            title: "修改服务失败!",
                            text: `${json.message !== null ? json.message : "3 秒后自动关闭!"}`,
                            icon: "error",
                            // button: "关闭",
                            buttons: false,
                            timer: 3000,
                        });
                    }
                }, 1000);
                // reset
                reset.click();
            }).catch(err  => console.log(`error`, err));
            return false;
        });
        let {
            user_name,
            role,
            // password,
            email,
            // role_desc,
        } = jsonObj;
        let input_name = document.querySelector(`input[name="user_name"]`),
            input_role = document.querySelector(`select[name="role"]`),
            input_email = document.querySelector(`input[name="email"]`);
        input_name.value = `${user_name}`;
        input_name.setAttribute(`disabled`, `disabled`);
        // input_name.setAttribute(`readonly`, `readonly`);
        input_email.value = `${email}`;
        input_role.value = `${role}`;
        // update select
        form.render("select");
    });
};


shit layui & px

https://www.layui.com/doc/modules/layer.html#area

area: ["800px", "400px"],


const showAddFormModal = (addProject, title = "增加用户") => {
    // DOM
    layui.use("layer", function() {
        let layer = layui.layer;
        // 修改
        // <option value="Admin">管理员</option>
        modalIndex = layer.open({
            title: `<h3>${title}</h3>`,
            content: `
                <section data-box="form-box">
                    <formaction="">
                        <div>
                            <labeltitle="用户名">用户名</label>
                            <div>
                                <input type="text" name="user_name" required lay-verify="required" placeholder="请输入用户名" autocomplete="off">
                            </div>
                        </div>
                        <div>
                            <labeltitle="角色类型">角色类型</label>
                            <div>
                                <select name="role" lay-verify="required" lay-filter="project-type" lay-search>
                                    <option value="Developer">开发</option>
                                    <option value="Operator">配管</option>
                                </select>
                            </div>
                        </div>
                        <div>
                            <labeltitle="密码">密码</label>
                            <div>
                                <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off">
                            </div>
                        </div>
                        <div>
                            <labeltitle="邮箱">邮箱</label>
                            <div>
                                <input type="email" name="email" placeholder="请输入邮箱" autocomplete="off">
                            </div>
                        </div>
                        <div>
                            <div>
                                <button type="submit"lay-submit lay-filter="formDemo">提交</button>
                                <button type="reset">重置</button>
                            </div>
                        </div>
                    </form>
                </section>
            `,
            area: ["800px", "400px"],
            btn: [],
            type: 1,
            success: function(layero, index){
                addProject();
            },
        });
    });
};


async & delay bug

image


    // async & delay bug
    setTimeout(() => {
        input_role.value = `${role}`;
        // update select
        console.log(`render select 3`);
        form.render("select");
    }, 100);


const editProject = () => {
    let reset = document.querySelector(`button[type="reset"]`);
    layui.use("form", function() {
        let form = layui.form,
            layer = layui.layer;
        // init select
        console.log(`render select 1`);
        form.render("select");
        fetchJSON(`${FetchIP}/http/sign/roles`).then(json => {
            let select = document.querySelector(`[lay-filter="project-type"]`);
            let html = ``;
            if (json.success) {
                const obj = json.data;
                let keys = Object.keys(obj);
                let newObj = {};
                keys.forEach(
                    (key, i) => {
                        if (key !== "Admin") {
                            let value = obj[key].name;
                            newObj[key] = value;
                            html += `<option value="${key}">${value}</option>`;
                            // html += `<option value="Complex">综合</option>`;
                        } else {
                            // no need Admin
                        }
                    }
                );
                // console.log(`new options =`, JSON.stringify(newObj, null, 4));
                select.innerHTML = "";
                select.insertAdjacentHTML(`beforeend`, html);
                console.log(`render select 2`);
                form.render("select");
            } else {
                html += `
                    <option value="Developer">开发</option>
                    <option value="Operator">配管</option>
                    <option value="Complex">综合</option>
                `;
                select.innerHTML = "";
                select.insertAdjacentHTML(`beforeend`, html);
                console.log(`render select 4`);
                form.render("select");
            }
        }).catch(err  => console.log(`error`, err));
        form.on(''submit(formDemo)'', function(data) {
            let {
                user_name,
                role,
                password,
                email,
            } = data.field;
            let query_obj = {
                user_name,
                role,
                password
            };
            // filter
            if (email) {
                query_obj.email = email;
            }
            let url = `${fetchIP}/http/sign/updateuser?${encodeURIComponent(JSON.stringify(query_obj))}`;
            getDatas(url).then(json => {
                // loading
                let loadingIndex = layer.load(1, {
                    time: 1*1000,
                });
                let resetButton = document.querySelector(`button[type="reset"]`);
                setTimeout(() => {
                    layer.close(loadingIndex);
                    if (json.success) {
                        layer.close(modalIndex);
                        swal({
                            title: "修改服务成功!",
                            text: `${json.message !== null ? json.message : "3 秒后自动关闭!"}`,
                            icon: "success",
                            // button: "关闭",
                            buttons: false,
                            timer: 3000,
                        });
                        resetButton.click();
                        loadList();
                    } else {
                        swal({
                            title: "修改服务失败!",
                            text: `${json.message !== null ? json.message : "3 秒后自动关闭!"}`,
                            icon: "error",
                            // button: "关闭",
                            buttons: false,
                            timer: 3000,
                        });
                    }
                }, 1000);
                // reset
                reset.click();
            }).catch(err  => console.log(`error`, err));
            return false;
        });
        let {
            user_name,
            role,
            // password,
            email,
            // role_desc,
        } = jsonObj;
        console.log(`user infos =`, JSON.stringify(jsonObj, null, 4));
        let input_name = document.querySelector(`input[name="user_name"]`),
            input_role = document.querySelector(`select[name="role"]`),
            input_email = document.querySelector(`input[name="email"]`);
        input_name.value = `${user_name}`;
        input_name.setAttribute(`disabled`, `disabled`);
        // input_name.setAttribute(`readonly`, `readonly`);
        if (email) {
            input_email.value = `${email}`;
        }
        // async & delay bug
        setTimeout(() => {
            input_role.value = `${role}`;
            // update select
            console.log(`render select 3`);
            form.render("select");
        }, 100);
    });
};



*** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot

*** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot

高春辉、王春生、朱峰:关于开源创业的 15 件小事

今天在 用故事板布局的过程中,新建一个 FKAuthorTableViewController 继承与 UITableViewController,然后沿用系统自带的 cellForRow 代理方法:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
    
    // Configure the cell...
    
    return cell;
}

然后运行程序,崩溃信息为:*** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:6573.

 

解决方案为 用

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];

替代    

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid forIndexPath:indexPath];

原因如下:

My bad! It seems to be you are using dequeueReusableCellWithIdentifier:forIndexPath: method for dequeueing cell. Please try dequeueReusableCellWithIdentifier: instead and it should work.

dequeueReusableCellWithIdentifier:forIndexPath: expects a nib file or a registered class for dequeueing cells but you are using storyboard prototype cell. And dequeueReusableCellWithIdentifier: is guaranteed to return a cell from storyboard if you use correct identifier.

意思为:预想加载宇哥 nib 文件或者注册的单元格,但是你用故事板生成的单元格,第二个方法可以保证在 identifier 正确的情况从故事板返回一个单元格。

<oracle.adf.view> <SimpleSelectOneRenderer> <_getSelectedIndex> <Could not find selected item matchi

<_getSelectedIndex>

在进入页面的时候,经常会见到log 日志控制台会抛出如下提示信息:

<oracle.adf.view> <SimpleSelectOneRenderer> <_getSelectedindex> <Could not find selected item matching value "{0}" in {1}>
<oracle.adf.view> <SimpleSelectOneRenderer> <_getSelectedindex> <Could not find selected item matching value "{0}" in {1}>
<oracle.adf.view> <SimpleSelectOneRenderer> <_getSelectedindex> <Could not find selected item matching value "{0}" in {1}>
<oracle.adf.view> <SimpleSelectOneRenderer> <_getSelectedindex> <Could not find selected item matching value "{0}" in {1}>
<oracle.adf.view> <SimpleSelectOneRenderer> <_getSelectedindex> <Could not find selected item matching value "{0}" in {1}>

如图:


解决办法如下:在给字段设置lov的时候,去掉勾选是否包含空选项,如图:去掉最下方 Include "No Selection Item"



android bsp & x86 architect & build release engineer 三个招聘

android bsp & x86 architect & build release engineer 三个招聘

职位1 x86服务器产品架构师 某top美资 上海张江 要求本科or 硕士3 - 6年之间,对x86架构精通,操作系统精通,虚拟机也有要求,有VCP者优先。预算20 - 30w之间 

职位2 android bsp development engineer 本科五年以上 硕士三年以上 相关的手机 平板 汽车多媒体的产品经验,每年按出差去美国一到两次,口语能技术交流即可。 预算24 - 30w之间

职位3 build release engineer 美资 本科 or 硕士3 - 6年 有bash 或 shell 或perl 或python开发经验,有git 或gerrit经验 配置管理工程师两名 英文过关,预算20 - 30w之间。 需要去美国出差1个月左右 一年。

职位4 android BSP AE 上海 美资 要求android bsp背景的兄弟到芯片公司做AE,85%技术开发,15%对接客户,沟通能力良好,英文良好。硕士2 - 6年为佳,20 - 30w之间。

先post这么多吧,有想换工作的兄弟姐妹,都可以找我,
msn kedan666@hotmail.com
http://www.weibo.com/80213864

angular – Renderer multiple selectRootElement Issue

angular – Renderer multiple selectRootElement Issue

我正在尝试使用Renderer.selectRootElement从我的Component获取一些元素,如 here所述.

除非我只选择一个元素(plnkr),否则一切正常.

如您所见,我创建了一个组件:

export class ExampleComponent implements OnInit{
    @input() start: any;
    @input() end: any;

  constructor(public _renderer:Renderer){

  };

    ngOnChanges(){

    }
    ngOnInit(){
        console.log("NG ON CHAN START DATE",this.start);
        console.log("NG ON INIT END DATE",this.end);
        var container =  this._renderer.selectRootElement('.container');
        console.log(container);   
        var inner1 =  this._renderer.selectRootElement('.inner1');
        console.log(inner1);   
        var inner2 =  this._renderer.selectRootElement('.inner2');
        console.log(inner2);   
    }

}

当我尝试运行它时,我有一个错误:

EXCEPTION: The selector “.inner1” did not match any elements in [{{exampleData.end}} in MainViewComponent@3:65]

(但是,在我的应用程序中,当只找到第一个容器时,则找不到其他容器).

这有什么想法来自哪里?

UPDATE

我发现该指令未被完全调用 – 只有带有类容器的div被添加到HTML中.

enter image description here

解决方法

不要使用selectRootElement

其目的不是在组件视图中按选择器选择随机元素.

只需在DomRootRenderer中看到它的实现

selectRootElement(selector: string): Element {
    var el = DOM.querySelector(this._rootRenderer.document,selector);
    if (isBlank(el)) {
      throw new BaseException(`The selector "${selector}" did not match any elements`);
    }
    DOM.clearNodes(el);
    return el;
 }

你看到有趣的东西吗?它正在删除元素内的节点!为什么会这样做?因为它的目的是抓住根元素!那么哪一个是根元素?这听起来很熟悉吗?

<my-app>
    Loading...
</my-app>

是!那是根本要素.好的,但是如果我只想抓住元素,那么使用selectRootElement有什么问题?它返回没有子元素的元素,视图中没有任何变化!嗯,当然你仍然可以使用它,但是你将会像使用DynamicComponentLoader#loadAsRoot并手动订阅EventEmitter一样击败它的目的并滥用它.

好吧,毕竟它的名字,selectRootElement,几乎说它做什么,不是吗?

您有两种方法可以抓取视图中的元素,以及两个正确的选项.

>使用局部变量和@ViewChild

<div #myElement>...</div>

@ViewChild('myElement') element: ElementRef;

ngAfterViewInit() {
   // Do something with this.element
}

>创建一个指令来获取所需的元素

@Directive({
    selector : '.inner1,inner2' // Specify all children
    // or make one generic
    // selector : '.inner'
})
class Children {}

template : `
    <div>
        <div></div>
        <div></div>

        <!-- or one generic
            <div></div>
            <div></div>
        -->
    </div>
`
class Parent (
    @ViewChildren(Children) children: QueryList<Children>;
    ngAfterViewInit() {
        // Do something with this.children
    }
)

关于shit layui & select & re-render & bug的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于*** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot、 <_getSelectedIndex> 的相关知识,请在本站寻找。

本文标签: