Coder Social home page Coder Social logo

jsonSpace不生效 about cxselect HOT 4 CLOSED

ciaoca avatar ciaoca commented on June 14, 2024
jsonSpace不生效

from cxselect.

Comments (4)

ciaoca avatar ciaoca commented on June 14, 2024

demo 示例已增加,可参考
http://ciaoca.github.io/cxSelect/demo/oneself.html

from cxselect.

yoyo0926 avatar yoyo0926 commented on June 14, 2024

谢谢,我把jquery.cxselect.js看了一遍,发现在218行

if ($.isArray(data)) {

这个判断条件有问题,因为我给了jsonSpace,我给它加了一个反向判断,改成 if (!$.isArray(data)) {

就生效了..

from cxselect.

yoyo0926 avatar yoyo0926 commented on June 14, 2024

上面代码不太好弄,我将文件整理成一个html,引用的是示例站上的Js,可以直接下载运行的
test3.html.zip

这个是按照demo的json数据改了一下,加了一层data,作者可以跑一下试试,它确实不生效

from cxselect.

ciaoca avatar ciaoca commented on June 14, 2024

jsonSpace 主要是为了解决使用接口获取数据,无需另外处理,方便使用。
如果是自定义的数据,直接赋值就行,没有必要使用该参数,例如: data: dataCustom.data
以及自行通过 ajax 获取到数据处理后,再调用参考:

ajax(...).done((res) => {
  $('#city_china').cxSelect({
    data: res.data
    selects: ['province', 'city', 'area']
  });
});

from cxselect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.